javaapache-httpclient-4.x

How to configure async apache http client 5 to use SOCKS proxy?


I'm trying to configure async http client to use SOCKS proxy. Here is the answer for sync http client. I don't know how to set ConnectionSocketFactory to async http client. Is it possible?


Solution

  • It turns out it's even easier than in sync http client:

    HttpAsyncClients.custom()
            .setIOReactorConfig(
                IOReactorConfig.custom()
                    .setSocksProxyAddress(InetSocketAddress("mysockshost", 1234))
                    .build()
            )
            .build()