简体   繁体   English

Android Emulator:设置代理服务器时如何不代理10.0.2.2?

[英]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. 在模拟器上进行开发时,我想在连接到10.0.2.2时在本地计算机上运行一个服务器,但是我也想使用代理服务器访问Internet以进行其他连接。 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. 我最终使用代理服务器( WireMock )来接收所有流量,然后通过映射可以决定将请求代理到何处。 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. WireMock还可以使用另一个代理服务器将请求发送到最终目的地,这是很好的。

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. 如果我想使用真实的设备,我甚至可以使用“ adb reverse”通过USB发送请求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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