You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Kenny Smith <to...@journalscape.com> on 2003/03/24 20:12:55 UTC

[httpclient] How to determine if connection is alive?

Hello,

I'm currently using 2.0a1 (I can't upgrade to the current release yet 
for production reasons) and I'm using Keep-Alive connections. I would 
like to find out if my connection is still alive, but I can't find any 
way to determine that. I've found the isAlive() method in HttpConnection 
object, but I can't find anyway to get an instance of the HttpConnection 
object.

My overall goal: We are testing an application where apache will have 
Keep-Alives turned off. My testing app will use HttpClient to try to 
create a Keep-Alive connection and hold it open as long as possible. In 
the previous version, the thread making the request would just sleep for 
x number of seconds, but I want the code to move ahead and make the next 
request if apache forces the connection closed (i.e. correctly stops the 
Keep-Alive) so simply sleeping x number of seconds blindly doesn't work 
for me.

Any help is appreciated, thanks!
Kenny Smith