Java – With Apache HttpClient, why isn’t the connection timeout working


My implementation of httpclient occasionally throws an exception when calling doGetConnection(). However, I have the following timeout set


it looks almost like my timeout is not being picked up. Is there anywhere else I need to set a timeout to ensure this behaviour does not re-occur

Best Solution

What exception are you getting thrown ?

Don't forget you have two timeouts to change/check. From HttpConnectionParams


so you can control how long you wait for a connection to the server, and how long operations on the socket can take before timing out.