I am using async-http-client-2.0.37.jar in my java application. I am always getting Request timeout
java.util.concurrent.TimeoutException: Request timeout to
www.google.co.in/172.217.26.163:80 after 60000 ms
at org.asynchttpclient.netty.timeout.TimeoutTimerTask.expire(TimeoutTimerTask.java:43)
at org.asynchttpclient.netty.timeout.RequestTimeoutTimerTask.run(RequestTimeoutTimerTask.java:48)
at io.netty.util.HashedWheelTimer$HashedWheelTimeout.expire(HashedWheelTimer.java:663)
at io.netty.util.HashedWheelTimer$HashedWheelBucket.expireTimeouts(HashedWheelTimer.java:738)
at io.netty.util.HashedWheelTimer$Worker.run(HashedWheelTimer.java:466)
at java.lang.Thread.run(Thread.java:748)
Please find my code which I am using below:
AsyncHttpClient asyncHttpClient = new DefaultAsyncHttpClient();
asyncHttpClient.prepareGet("
http://www.google.co.in/").execute(new AsyncCompletionHandler<Response>(){
public State onStatusReceived(final HttpResponseStatus status) throws Exception {
System.out.println(status.getStatusCode());
return State.CONTINUE;
}
@Override
public Response onCompleted(Response response) throws Exception{
System.out.println("completed : " + response.getStatusCode());
return response;
}
@Override
public void onThrowable(Throwable t){
t.printStackTrace();
System.out.println("throw");
}
});
I am getting status code in the output as 200 but I am always getting the above timeout exception. I have tried different URLs as well, getting timeout for every URL. And one more issue is whenever I use https URL I don't even get status code, but it will timeout after 60s.
Please guide on what should I do to solve this.