简体   繁体   中英

AsyncHttpClient Connection Timeout not working

I'm using AsyncHttpClient to make HTTP request through proxy server, but seems connect timeout not working, even if I configured it to be 65 seconds (proxies can work very slow).

I'm receiving java.util.concurrent.ExecutionException backed by java.net.ConnectException (ie application don't wait until proxy server return response) after 0-20 secs (ie timeout is random every time)

   Integer timeout = 65000 // 65 secs
   AsyncHttpClientConfig cfg = new AsyncHttpClientConfig.Builder( ).
                setConnectTimeout( timeout ).
                setRequestTimeout( timeout ).
                setAcceptAnyCertificate( true ).
                setUserAgent( userAgent ).
                setProxyServer( new ProxyServer( proxy.ip, proxy.port ) ).
                build( )

      AsyncHttpClient client = new AsyncHttpClient( cfg )

      Response response = client.prepareGet( url).execute().get()

最好的报告问题的方法是在Github上使用我们的bugtracker ,并提供您所使用的版本和提供程序(Netty,Grizzly和JDK)。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM