当我创建一个DefaultHttpClient对象,并尝试打一个网页,该请求不通过我在设置中指定的代理路由。
When I create a DefaultHttpClient object and try to hit a webpage, the request isn't routed through the proxy I specified in Settings.
综观API文档,我没有看到任何地方,我可以指定代理,虽然Android的确实有一个Proxy类,允许我读系统的代理设置。
Looking through the API docs, I don't see anywhere where I can specify a proxy though Android does have a Proxy class that allows me to read the system's proxy settings.
有没有一种方法可以让我在使用的代理服务器设置的HttpClient的?
Is there a way I can use the proxy settings in an HttpClient?
尝试:
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpHost proxy = new HttpHost("someproxy", 8080);
httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
(从扑杀这里)