Hello all

I´m having an issue with my app, where reusing a HttpClient sometimes
throws an exception,
and I can´t figure out why.

I have an HttpClient factory looking like this:

public class HttpClientFactory {

    private static DefaultHttpClient client;

    public synchronized static DefaultHttpClient getThreadSafeClient()
{

        if (client != null)
            return client;

        client = new DefaultHttpClient();

        ClientConnectionManager mgr = client.getConnectionManager();

        HttpParams params = client.getParams();
        client = new DefaultHttpClient(
        new ThreadSafeClientConnManager(params,
            mgr.getSchemeRegistry()), params);

        return client;
    }
}

Like mentioned, an exception is thrown sometimes (but not always) when
I call the method posted above.
The exception only seems to occur when using HTTPS, and from what I
can tell it only seems to happen after using the client,
leaving the phone for a couple of minutes, and then resuing the
connection.

The exception thrown can be seen below. Any suggestions on a solution
or workaround?

Exception thrown:

SSL shutdown failed: I/O error during system call, Broken pipe
java.io.IOException: SSL shutdown failed: I/O error during system
call, Broken pipe
 at
org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.nativeclose(Native
Method)
 at
org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.close(OpenSSLSocketImpl.java:
958)
 at
org.apache.http.impl.SocketHttpClientConnection.close(SocketHttpClientConnection.java:
205)
 at
org.apache.http.impl.conn.DefaultClientConnection.close(DefaultClientConnection.java:
161)
 at
org.apache.http.impl.conn.AbstractPooledConnAdapter.close(AbstractPooledConnAdapter.java:
158)
 at
org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:
337)
 at
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:
555)
 at
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:
487)
 at
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:
465)
 at
org.restlet.example.android.serialisation.utils.xml.UserBalanceHelper.get(UserBalanceHelper.java:
42)
 at org.restlet.example.android.serialisation.activity.CouponActivity
$4.run(CouponActivity.java:314)

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to