asynchttpclient

How to setup proxy in AsyncHttpClient?


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??


Solution

  • Try like this

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