2016-05-23 38 views
0

我的应用程序使用AsyncHttpClient库进行网络操作。我的问题是我需要指定代理端口为了连接到远程server.Any想指定它?如何在AsyncHttpClient中设置代理?

+1

我希望你试过这种http://people.apache.org/~simonetripodi/ahc/proxy.html –

回答

0

尝试这样

AsyncHttpClientConfig cf = new DefaultAsyncHttpClientConfig.Builder() 
.setProxyServer(new ProxyServer.Builder("127.0.0.1", 38080)).build(); 

AsyncHttpClient c = new DefaultAsyncHttpClient(cf);