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: [email protected]
> For additional commands, e-mail: [email protected]
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to