hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "droidin.net" <dr...@droidin.net>
Subject Re: ThreadSafeClientConnManager and java.net.SocketException: Connection reset
Date Thu, 27 Aug 2009 16:34:46 GMT

Hi Oleg,

It's ether nibble or I'm slow - I only got word "This" from your reply. If
I'm doing these 2 lines wrong how should I do it?

Regards,

Bo


olegk wrote:
> 
> On Wed, Aug 26, 2009 at 01:19:17PM -0700, droidin.net wrote:
>> 
>> I define HttpClient in 2 different ways:
>> 1. Plain vanilla: client = new DefaultHttpClient();
>> 2. Thread safe:
>>     private DefaultHttpClient getThreadSafeHttpClient() {
>>         HttpParams params = new BasicHttpParams();
>>         params.setParameter("http.useragent", USER_AGENT);
>>         HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
>>         HttpProtocolParams.setContentCharset(params, "UTF-8");
>>         final SchemeRegistry registry = new SchemeRegistry();
>>         registry.register(new Scheme("http",
>> PlainSocketFactory.getSocketFactory(), 80));
>>         registry.register(new Scheme("https",
>> PlainSocketFactory.getSocketFactory(), 443));
> 
> This.
> 
> Oleg
> 
> 
> 
>>         final ThreadSafeClientConnManager manager = new
>> ThreadSafeClientConnManager(params, registry);
>>         return new DefaultHttpClient(manager, params);
>>     }
>> 
>> Then I run same JUnit test for both client types (simple GET request). #1
>> always runs fine, #2 always fails with "java.net.SocketException:
>> Connection
>> reset". Debug/stacktrace output attached (fictitious site)
>> 
>> I never get a chance to do anything with entity object since error is
>> thrown
>> at client#execute call
>> 
>> http://www.nabble.com/file/p25157321/error.log error.log 
>> -- 
>> View this message in context:
>> http://www.nabble.com/ThreadSafeClientConnManager-and-java.net.SocketException%3A-Connection-reset-tp25157321p25157321.html
>> Sent from the HttpClient-User mailing list archive at Nabble.com.
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/ThreadSafeClientConnManager-and-java.net.SocketException%3A-Connection-reset-tp25157321p25174110.html
Sent from the HttpClient-User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message