2

I'm using AndroidHttpClient to connect to my server over https. Certificates are ok, but sometimes on bad internet connection an exception is thrown. Url is always the same.

I/ActivityManager(  300): Displayed ru.mw.android/.FavouritesActivity: +387ms
W/System.err( 2045): javax.net.ssl.SSLException: SSL handshake aborted: ssl=0x5c02f980: I/O error during system call, Connection reset by peer
W/System.err( 2045):    at org.apache.harmony.xnet.provider.jsse.NativeCrypto.SSL_do_handshake(Native Method)
W/System.err( 2045):    at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:395)
W/System.err( 2045):    at android.net.SSLCertificateSocketFactory.verifyHostname(SSLCertificateSocketFactory.java:189)
W/System.err( 2045):    at android.net.SSLCertificateSocketFactory.createSocket(SSLCertificateSocketFactory.java:332)
W/System.err( 2045):    at org.apache.http.conn.ssl.SSLSocketFactory.createSocket(SSLSocketFactory.java:375)
W/System.err( 2045):    at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:165)
W/System.err( 2045):    at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
W/System.err( 2045):    at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
W/System.err( 2045):    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360)
W/System.err( 2045):    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
W/System.err( 2045):    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
W/System.err( 2045):    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
W/System.err( 2045):    at android.net.http.AndroidHttpClient.execute(AndroidHttpClient.java:252)
Joshua Pinter
  • 45,245
  • 23
  • 243
  • 245
nixan
  • 523
  • 1
  • 6
  • 13
  • It seems like a network issue. Are you sure there's nothing running in the background that can stress your connection ? – Madushan Aug 10 '12 at 11:18
  • @Madushan it looks like I've found out the issue. SSL connection is initialised using wifi connection, then immidiately I swap to GSM so my IP is changed. From the server's point it looks like an IP spoofing, so the SSL session resets and that is why the exception is thrown and it is an instance of SSLException. – nixan Aug 12 '12 at 20:00
  • 2
    Ran into this answer that I think will help you out: http://stackoverflow.com/questions/12885247/why-is-httpurlconnection-throwing-an-sslexception-while-on-a-mobile-data-connect – Udinic Jan 06 '13 at 09:53
  • How do we handle it in application ? – png Apr 08 '15 at 12:38

0 Answers0