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

httpclientjava

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

_moHttpClient.setHttpConnectionFactoryTimeout(30000);

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 Answer

What exception are you getting thrown ?

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

setConnectionTimeout()
setSoTimeout()

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.

Related Topic