When using Android's HttpUrlConnection
library to make an HTTPS request, I sometimes see the following exception being thrown:
javax.net.ssl.SSLException: SSL handshake aborted: ssl=0x5c1b18a0: I/O error during system call, Connection reset by peer
at org.apache.harmony.xnet.provider.jsse.NativeCrypto.SSL_do_handshake(Native Method)
at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:395)
...
After digging into the issue a bit, I've learned that
- Everything works fine on wifi
- The exception is only thrown when the device is on a mobile data connection
- After making an HTTPS over wifi first, connecting over mobile data tends to work fine for a while
- The problem appears to happen on a small number of specific mobile carriers
What could be happening? Are some mobile carriers interfering with HTTPS traffic?