2021-12-07 13:16:05.165 [TRACE] Connection lost timer started
2021-12-07 13:16:05.208 [INFO] Server.onStart
2021-12-07 13:16:05.208 [INFO] Listening on localhost/127.0.0.1:5008
2021-12-07 13:16:19.876 [INFO] Connecting now...
2021-12-07 13:16:19.876 [TRACE] write(153): GET / HTTP/1.1
Connection: Upgrade
Host: localhost:5008
Sec-WebSocket-Key: o2UQnaB+hYeNsbPJmHb33A==
Sec-WebSocket-Version: 13
Upgrade: websocket
2021-12-07 13:16:19.888 [TRACE] process(153): (GET / HTTP/1.1
Connection: Upgrade
Host: localhost:5008
Sec-WebSocket-Key: o2UQnaB+hYeNsbPJmHb33A==
Sec-WebSocket-Version: 13
Upgrade: websocket
)
2021-12-07 13:16:19.888 [TRACE] acceptHandshakeAsServer - Matching extension found: DefaultExtension
2021-12-07 13:16:19.888 [TRACE] acceptHandshake - Matching protocol found:
2021-12-07 13:16:19.903 [TRACE] write(212): HTTP/1.1 101 Web Socket Protocol Handshake
Connection: Upgrade
Date: Tue, 07 Dec 2021 12:16:19 GMT
Sec-WebSocket-Accept: 5GunGz4gMDDQdHm5gIZkNyIuyaE=
Server: TooTallNate Java-WebSocket
Upgrade: websocket
2021-12-07 13:16:19.903 [TRACE] open using draft: Draft_6455 extension: DefaultExtension protocol: max frame size: 2147483647
2021-12-07 13:16:19.903 [TRACE] process(212): (HTTP/1.1 101 Web Socket Protocol Handshake
Connection: Upgrade
Date: Tue, 07 Dec 2021 12:16:19 GMT
Sec-WebSocket-Accept: 5GunGz4gMDDQdHm5gIZkNyIuyaE=
Server: TooTallNate Java-WebSocket
Upgrade: websocket
)
2021-12-07 13:16:19.903 [INFO] Server.onOpen - with /127.0.0.1:52988
2021-12-07 13:16:19.903 [TRACE] acceptHandshakeAsClient - Matching extension found: DefaultExtension
2021-12-07 13:16:19.903 [TRACE] acceptHandshake - Matching protocol found:
2021-12-07 13:16:19.903 [TRACE] open using draft: Draft_6455 extension: DefaultExtension protocol: max frame size: 2147483647
2021-12-07 13:16:19.903 [TRACE] Connection lost timer started
2021-12-07 13:16:19.903 [INFO] Client.onOpen with localhost/127.0.0.1:5008
2021-12-07 13:16:19.903 [INFO] Connected successfully
2021-12-07 13:16:25.218 [TRACE] send frame: Framedata{ opcode:PING, fin:true, rsv1:false, rsv2:false, rsv3:false, payload length:[pos:0, len:0], payload:}
2021-12-07 13:16:25.218 [TRACE] afterEnconding(0):
2021-12-07 13:16:25.218 [TRACE] write(2): �
2021-12-07 13:16:25.218 [TRACE] process(2): (� )
2021-12-07 13:16:25.218 [TRACE] afterDecoding(0):
2021-12-07 13:16:25.218 [TRACE] matched frame: Framedata{ opcode:PING, fin:true, rsv1:false, rsv2:false, rsv3:false, payload length:[pos:0, len:0], payload:}
2021-12-07 13:16:25.218 [TRACE] send frame: Framedata{ opcode:PONG, fin:true, rsv1:false, rsv2:false, rsv3:false, payload length:[pos:0, len:0], payload:}
2021-12-07 13:16:25.218 [TRACE] afterEnconding(0):
2021-12-07 13:16:25.218 [TRACE] write(6): ���bG�
2021-12-07 13:16:25.218 [TRACE] process(6): (���bG�)
2021-12-07 13:16:25.218 [TRACE] afterDecoding(0):
2021-12-07 13:16:25.218 [TRACE] matched frame: Framedata{ opcode:PONG, fin:true, rsv1:false, rsv2:false, rsv3:false, payload length:[pos:0, len:0], payload:}
2021-12-07 13:16:29.929 [TRACE] Closing connection due to no pong received: org.java_websocket.WebSocketImpl@63581375
2021-12-07 13:16:29.929 [TRACE] Connection lost timer stopped
2021-12-07 13:16:29.929 [INFO] Client.onClose - code = 1006, reason = The connection was closed because the other endpoint did not respond with a pong in time. For more information check: https://github.com/TooTallNate/Java-WebSocket/wiki/Lost-connection-detection, remote = false
2021-12-07 13:16:29.929 [INFO] Server.onClose - conn = org.java_websocket.WebSocketImpl@59698028, code = 1006, reason = , remote = true
Describe the bug
When creating a WebSocketClient and not connecting it immediately, the lost-connection-detection doesn't work properly and the client fails with a missing pong. This only occurs when connecting the client after a delay. At most one "round of pings" is sent before the client closes the connection.
To Reproduce
Steps to reproduce the behavior:
Server
Client
Main-Method
Expected behavior
I expect the client to not fail in this case :)
Debug log
LOG
Environment:
Additional context
In the Reproduce-Example I set the ConnectionLostTimeout to a lower value than the default 60 seconds so I don't have to wait every time I test it. I think this also works with the default, but then the Timer-Delay would have to be bigger.