https://bz.apache.org/bugzilla/show_bug.cgi?id=59014
Bug ID: 59014
Summary: No CloseMessage because of WebSocket connection has
been closed
Product: Tomcat 8
Version: 8.0.32
Hardware: PC
OS: All
Status: NEW
Severity: major
Priority: P2
Component: WebSocket
Assignee: [email protected]
Reporter: [email protected]
In our test-cases we would like to handle
Endpoint.onClose(Session session, CloseReason closeReason) {}
But looks the code isn't reachable.
WsSession does:
state = State.CLOSED_SENT;
...
sendCloseMessage(closeReasonMessage);
Where we have the code like in WsRemoteEndpointImplBase.startMessageBlock:
FutureToSendHandler f2sh = new FutureToSendHandler(wsSession);
startMessage(opCode, payload, last, f2sh);
try {
if (timeout == -1) {
f2sh.get();
} else {
f2sh.get(timeout, TimeUnit.MILLISECONDS);
}
That f2sh.get() does this:
wsSession.registerFuture(this);
where:
if (isOpen()) {
futures.put(f2sh, f2sh);
}
is false because our state is State.CLOSED_SENT not like:
state == State.OPEN || state == State.SENDING_CLOSED
Therefore we never get result from that Future and our onClose() test fail.
You can find more info in the bug57489, especially
https://bz.apache.org/bugzilla/show_bug.cgi?id=58624#c13 and its attachment.
The related Spring Integration JIRA: https://jira.spring.io/browse/INT-3909.
Thank you in advance!
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]