gdx-websockets
gdx-websockets copied to clipboard
wss connection on iOS is not working
When I'm building with RoboVM for iOS, I'm having an issue. The issue arises from the absence of the class javax.net.ssl.SNIHostName in the RoboVM runtime library. It happens on calling socket.connect(); method. However, for unknown reasons, the library relies on it. Have you attempted to establish a secure socket connection on an iOS build? Is there a workaround?
I'm initializing the socket with the following WebSockets.newSocket(WebSockets.toSecureWebSocketUrl("myserver.com", 443, "websocket"));
On all other platforms there is no issues. Adding javax.net.ssl.SNIHostName to the forceLinkClasses doesnt help because it doesn't exist in the runtime.
[WARN] java.lang.Class: Class.forName() failed to load 'javax.net.ssl.SNIHostName'. Use the -forcelinkclasses command line option or add <forceLinkClasses><pattern>javax.net.ssl.SNIHostName</pattern></forceLinkClasses> to your robovm.xml file to link it in. com.neovisionaries.ws.client.WebSocketException: Failed to get the input stream of the raw socket: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x1088127f0: Failure in SSL library, usually a protocol error error:14077102:SSL routines:SSL23_GET_SERVER_HELLO:unsupported protocol (/Users/tomski/Coding/asidik/robovm/target/checkout/compiler/vm/rt/android/external/openssl/ssl/s23_clnt.c:714 0x104d8327d:0x00000000) at com.neovisionaries.ws.client.WebSocket.openInputStream(WebSocket.java:3349) at com.neovisionaries.ws.client.WebSocket.shakeHands(WebSocket.java:3307) at com.neovisionaries.ws.client.WebSocket.connect(WebSocket.java:2354) at com.neovisionaries.ws.client.ConnectThread.runMain(ConnectThread.java:32) at com.neovisionaries.ws.client.WebSocketThread.run(WebSocketThread.java:45) Caused by: javax.net.ssl.SSLHandshakeException: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x1088127f0: Failure in SSL library, usually a protocol error error:14077102:SSL routines:SSL23_GET_SERVER_HELLO:unsupported protocol (/Users/tomski/Coding/asidik/robovm/target/checkout/compiler/vm/rt/android/external/openssl/ssl/s23_clnt.c:714 0x104d8327d:0x00000000) at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:568) at com.android.org.conscrypt.OpenSSLSocketImpl.waitForHandshake(OpenSSLSocketImpl.java:834) at com.android.org.conscrypt.OpenSSLSocketImpl.getInputStream(OpenSSLSocketImpl.java:797) at com.neovisionaries.ws.client.WebSocket.openInputStream(WebSocket.java:3342) ... 4 more Caused by: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x1088127f0: Failure in SSL library, usually a protocol error error:14077102:SSL routines:SSL23_GET_SERVER_HELLO:unsupported protocol (/Users/tomski/Coding/asidik/robovm/target/checkout/compiler/vm/rt/android/external/openssl/ssl/s23_clnt.c:714 0x104d8327d:0x00000000) at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method) at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:486) ... 7 more com.neovisionaries.ws.client.WebSocketException: Failed to get the input stream of the raw socket: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x1088127f0: Failure in SSL library, usually a protocol error error:14077102:SSL routines:SSL23_GET_SERVER_HELLO:unsupported protocol (/Users/tomski/Coding/asidik/robovm/target/checkout/compiler/vm/rt/android/external/openssl/ssl/s23_clnt.c:714 0x104d8327d:0x00000000) at com.neovisionaries.ws.client.WebSocket.openInputStream(WebSocket.java:3349) at com.neovisionaries.ws.client.WebSocket.shakeHands(WebSocket.java:3307) at com.neovisionaries.ws.client.WebSocket.connect(WebSocket.java:2354) at com.neovisionaries.ws.client.ConnectThread.runMain(ConnectThread.java:32) at com.neovisionaries.ws.client.WebSocketThread.run(WebSocketThread.java:45) Caused by: javax.net.ssl.SSLHandshakeException: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x1088127f0: Failure in SSL library, usually a protocol error error:14077102:SSL routines:SSL23_GET_SERVER_HELLO:unsupported protocol (/Users/tomski/Coding/asidik/robovm/target/checkout/compiler/vm/rt/android/external/openssl/ssl/s23_clnt.c:714 0x104d8327d:0x00000000) at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:568) at com.android.org.conscrypt.OpenSSLSocketImpl.waitForHandshake(OpenSSLSocketImpl.java:834) at com.android.org.conscrypt.OpenSSLSocketImpl.getInputStream(OpenSSLSocketImpl.java:797) at com.neovisionaries.ws.client.WebSocket.openInputStream(WebSocket.java:3342) ... 4 more Caused by: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x1088127f0: Failure in SSL library, usually a protocol error error:14077102:SSL routines:SSL23_GET_SERVER_HELLO:unsupported protocol (/Users/tomski/Coding/asidik/robovm/target/checkout/compiler/vm/rt/android/external/openssl/ssl/s23_clnt.c:714 0x104d8327d:0x00000000) at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method) at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:486) ... 7 more