Hi All,
I have been struggling with the Socket and Connection Timeouts with Apache
httpclient. I am getting two types of exceptions in my code (follows), when
1. SocketTimeoutException
2. Null value !
My question is Where is the SSL handShake is counted?
Is it the connection timeout or the socket timeout ? I have been juggling
with numbers as the Client takes anywhere from 7 - 120 seconds to process
the request ! I am trying to get to the correct number for Connection and
Socket Timeout.
Can someone assist?
// httpComm is a HttpClinet
httpComm.setConnectionTimeout( getHttpConnTimeout() );
httpComm.setTimeout( getHttpRespTimeout() );
// Execute request
try {
logIt( LoggerBase.INFO, "Executing Http post request..." );
result = _clnt.executeMethod( post );
logIt( LoggerBase.INFO, "HTTP response received..." );
logIt( LoggerBase.INFO, twoSpaces+"response status: "+
HttpStatus.getStatusText(result) );
// response header
Header[] rspHdr = post.getResponseHeaders();
logIt( LoggerBase.DATA, twoSpaces+"response header:" );
String hdroutput = new String();
for ( int i=0;i<rspHdr.length;i++ ) {
hdroutput += twoSpaces + rspHdr[i].toString();
}
logIt(LoggerBase.DATA, twoSpaces+hdroutput);
// response body
respBody = post.getResponseBodyAsString();
logIt(LoggerBase.DATA, twoSpaces+"response body:" );
logIt(LoggerBase.DATA, twoSpaces+respBody );
}
catch ( Exception e ) {
logIt(LoggerBase.WARN,"HttpClient/post failed (msg="+
e.getMessage()+")");
// logIt(LoggerBase.WARN,"HttpClient/post status: "+
// post.getStatusText());
e.printStackTrace( System.err );
}
2:16:36:40 09Jan07 |CngVal| Executing Http post request...
2-16:37:03 09Jan07 WARN |CngVal| HttpClient/post failed (msg=null)
6-14:08:01 05Jan07 |CngVal| Executing Http post request...
6:14:08:08 05Jan07 WARN |CngVal| HttpClient/post failed (msg=
java.net.SocketTimeoutException: Read timed out)