commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: [commons-httpclient] setConnectionTimeout not working?
Date Tue, 25 Apr 2006 07:51:36 GMT
On Mon, 2006-04-24 at 18:38 -0400, Alex wrote:
>   client = new HttpClient();
> 
>  
> 
> SimpleHttpConnectionManager mr = new SimpleHttpConnectionManager();
> 
> mr.getParams().setConnectionTimeout(1000);
> 
> client = new HttpClient(mr);   
> 
>  
> 
> 
> 
> long startTime = System.currentTimeMillis();
> 
> int resultCode = client.executeMethod(getMethod);  
> 
> setConnTime(System.currentTimeMillis()-startTime);  
> 
>  
> 
> 
> 
> my connection timeout is set to 1000 (1 second),  output shows that
> connection to some site took over 3-4 seconds and 
> 
> it never comes to "catch (ConnectTimeoutException e)"  
> 
>  
> 
> 
> 
> why is it not throwing ConnectTimeoutException?
> 

What's the JRE version that you are using? 

Try connecting to the host using a plain java.net.Socket and see if it
times out on connect.

Oleg


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message