简体   繁体   中英

Android Emulator: How to not proxy 10.0.2.2 when proxy server is setup?

While developing on my emulator, I want to hit a server on my local machine, when I connect to 10.0.2.2, but I also want to use my proxy server to get out to the Internet for other connections. Is there a way to do this without running my own proxy server? It's annoying that there's no way to have a list of excluded proxy hosts. Or maybe someone knows how to do that?

I ended up using a proxy server ( WireMock ) in order to receive all the traffic, and then with mappings I can decide where to proxy the request to. Either a service running locally, or a service that runs somewhere else. It's nice that WireMock can also use another proxy server to get the request to the final destination.

I can differentiate the different proxied endpoints using different mappings with different ports. If I want to use a real device I can use 'adb reverse' to send the request over USB even.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM