My app uses AsyncHttpClient library for network operation.My problem is i need to specify the proxy with port in order to connect to remote server.Any ideas to specify it??
Asked
Active
Viewed 2,826 times
3
-
1I hope you tried this http://people.apache.org/~simonetripodi/ahc/proxy.html – Balaji Katika May 23 '16 at 08:55
-
https://stackoverflow.com/questions/34846014/using-selenium-remotewebdriver-behind-corporate-proxy/68985455#68985455 – Ursache Sep 02 '21 at 11:44
2 Answers
7
Try like this
AsyncHttpClientConfig cf = new DefaultAsyncHttpClientConfig.Builder()
.setProxyServer(new ProxyServer.Builder("127.0.0.1", 38080)).build();
AsyncHttpClient c = new DefaultAsyncHttpClient(cf);

akhil Rao
- 1,169
- 7
- 17
1
Another posibility is to use the standard Java proxy-properties:
JDK_JAVA_OPTIONS=-Dhttps.proxyHost=<host> -Dhttps.proxyPort=<port> -Dhttp.proxyHost=<host> -Dhttp.proxyPort=<port>
AsyncHttpClientConfig config = new DefaultAsyncHttpClientConfig.Builder()
.setUseProxyProperties(true)
.build();

Hjelmen
- 91
- 2