We have the following code to talk to our website, and we have timeout threshold set at the HttpClient level to make sure "we don't wait for long time for get response back.". Does the code good enough to satisfy the requirement above? Do we need additional timeout setting for the HttpHead method as well?
HttpClient httpclient = new DefaultHttpClient();
// the time it takes to open TCP connection.
httpclient.getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, this.timeout);
// timeout when server does not send data.
httpclient.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT, this.timeout);
// the head method
HttpHead httphead = new HttpHead(url);
HttpResponse response = httpclient.execute(httphead);
HttpClient
, and the subsequent classes you mention? – wulfgar.pro Dec 5 '12 at 2:08HttpClient
is for the connection, and the timout you provide toHttpHead
is for the request. You might need to test this in your Integration Tests. – wulfgar.pro Dec 5 '12 at 2:20