Java client hangs when connecting to the server with secure web socket #105
Description
When I try to connect to the server from java client, application hangs and the following exception gets printed in the console:
Exception in thread "Thread-15" java.nio.BufferOverflowException
at java.nio.DirectByteBuffer.put(DirectByteBuffer.java:363)
at java.nio.DirectByteBuffer.put(DirectByteBuffer.java:342)
at sun.nio.ch.IOUtil.write(IOUtil.java:60)
at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:471)
at org.java_websocket.SSLSocketChannel2.close(SSLSocketChannel2.java:270)
at org.java_websocket.WebSocketImpl.closeConnection(WebSocketImpl.java:453)
at org.java_websocket.WebSocketImpl.closeConnection(WebSocketImpl.java:472)
at org.java_websocket.WebSocketImpl.eot(WebSocketImpl.java:509)
at org.java_websocket.client.WebSocketClient.interruptableRun(WebSocketClient.java:249)
at org.java_websocket.client.WebSocketClient.run(WebSocketClient.java:188)
at java.lang.Thread.run(Thread.java:745)
Looks like it keeps on waiting for the countdown latch in this line but it never gets decremented. It does not matter if I remove authorization data from the login request, it still occurs.
What is weird is when I connect to the very same server with JavaScript client, everything works as expected.
When WSS is disabled the client connects just fine but since JS client connects without any problem(with WSS enabled) I rule out the possibility that the WSS is poorly configured.
Did anyone else encounter this behavior?
Below is the code I use to setup a connection:
val ds = DeepstreamClient(deepstreamEndpoint) // "wss://myaddress:63200"
val loginReq = Gson().toJsonTree(LoginData(basicId, basicSecret))
val result = ds.login(loginReq) // << in my code it hangs here
if (result.loggedIn()) {
logger.info("Deepstream: Log in success!")
} else {
logger.info("Deepstream: Log in error!")
}
Using java client with version 2.0.4 and Linux Deepstream server 2.1.3.