
android-developer-preview - issue #1989
SSLHandshakeException when connecting to WebSocket over SSL
To expedite resolution of your issue, please provide as much relevant and specific information as possible. This will probably require some work from you. Most reports should include at least the following:
* Which version of the SDK are you using?
19 (Android 4.4.2)
* Which Android build are you using? (e.g. LPX13D)
LPX13D
* What device are you using?
Nexus 5
* What steps will reproduce the problem? (Please provide the minimal reproducible test case.)
Try to open a WebSocket connection over SSL to wss://talkserver-test1.talk.hoccer.de/ using Jetty WebSocket 8.1.16 library. I prepared a minimal test project at https://github.com/hoccer/WebSocket-Jetty-Test, see https://github.com/hoccer/WebSocket-Jetty-Test/blob/master/src/com/example/WebSocket_Jetty_Test/MainActivity.java.
* How frequently does the issue occur? (e.g. 100% of the time, 10% of the time)
100% of the time
* What is the expected output?
The connection will open successfully, onOpen() is called (works on Android 4.4.4). The test app will display "SUCCESS".
* What do you see instead?
The connection does not open, onClose() is called with error code 1006 and no error message. The test app will display "ERROR: 1006, null".
* Relevant logcat output.
11-13 11:28:23.203 745 ActivityManager I Displayed com.example.WebSocket_Jetty_Test/.MainActivity: +257ms 11-13 11:28:23.355 2791 WebSocketTest I onClose(1006, null) 11-13 11:28:23.356 2791 System.err W 2014-11-13 11:28:23.355:WARN:oeji.nio:javax.net.ssl.SSLHandshakeException: Handshake failed
The SSLHandshakeException is caused by one of these two errors:
javax.net.ssl.SSLProtocolException: SSL handshake terminated: ssl=0xaf53a200: Failure in SSL library, usually a protocol error error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number (external/openssl/ssl/s3_pkt.c:338 0xac4d4e61:0x00000000)
javax.net.ssl.SSLProtocolException: SSL handshake terminated: ssl=0xaf53a400: Failure in SSL library, usually a protocol error error:1408E0F4:SSL routines:SSL3_GET_MESSAGE:unexpected message (external/openssl/ssl/s3_both.c:498 0xac4d4e61:0x00000000)
It seems like the SSL handshake is interrupted at random points in time. The server log says "peer closed connection in SSL handshake while SSL handshaking".
* Captured Android bug report (i.e using adb bugreport.) Be wary of leaking private information!
I have created a bug report, but no quota to attach it to the issue.
Comment #1
Posted on Nov 18, 2014 by Helpful Wombat(No comment was entered for this change.)
Comment #2
Posted on May 28, 2015 by Helpful Wombat(No comment was entered for this change.)
Status: PreviousRelease
Labels:
Type-Defect
Restrict-AddIssueComment-Commit