Closed 4Mi closed 5 months ago
Hey,
looking at the code I would say that the timeout is set and used.
Best regards, Marcel
Could it be the case that the timeout is "just" set at the socket but the connectLatch
which gets awaited in connectBlocking
does not get notified?
I'm experiencing the problem when the service I'm trying to connecting to is down. The application sets a timeout via the JSON configuration but WebSocketClient.connectBlocking
does not return. Shouldn't a timeout from the socket connection also notify connectLatch
so that connectBlocking()
can actually return as advertised?
Using connectBlocking(long, TimeUnit)
with the same timeout instead of connectBlocking()
returns and allows my application to retry.
Hi @marci4, I think @sirhcel's argumentation is quite robust and seems to be a solution to the problem. Could you share some insights on why you resolved this issue as "not planned"?
Describe what you would like to know or do Precondition:
when i create socket with a connect timeout value 5 seconds as following: super(serverUri, new Draft_6455(), null, 5000);
after calling sockect.connect(), the onOpen() is not called, but after 15 minutes, the onError is called with following stack: 11-09 13:44:41.378 D/MssSocket( 6934): onError e: javax.net.ssl.SSLHandshakeException: SSL handshake aborted: ssl=0x8f209c80: I/O error during system call, Connection timed out 11-09 13:44:41.378 D/MssSocket( 6934): at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method) 11-09 13:44:41.378 D/MssSocket( 6934): at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:324) 11-09 13:44:41.378 D/MssSocket( 6934): at com.android.org.conscrypt.OpenSSLSocketImpl.waitForHandshake(OpenSSLSocketImpl.java:629) 11-09 13:44:41.378 D/MssSocket( 6934): at com.android.org.conscrypt.OpenSSLSocketImpl.getInputStream(OpenSSLSocketImpl.java:591) 11-09 13:44:41.378 D/MssSocket( 6934): at org.java_websocket.client.WebSocketClient.run(WebSocketClient.java:407)
It seems like that the connect timeout value which is set by constructor does not work.
Also, during the 15 minutes, i try closing the opening socket, but onClose() is not called. How can I set the connect timeout correctly? THANKS