I have a simple embedded Jetty 9 websocket server. I have a method like this in my annotated websocket implementation:
@OnWebSocketClose
void onClose(int statusCode, String reason) {
logger.info "Closed connection [${this}]"
connectionManager.remove(this)
Event closeEvent = commsEventFactory.buildCloseEvent(this, statusCode, reason)
eventReceiver.postEvent(closeEvent)
}
I have a spock test which connects to the server using async-http-client. I get a successful connection and can send messages back and forth.
However, onClose() is never called (when I call async-http-client's websocket.close() or client.close() or even when the test JVM dies).
I expected the onClose to fire immediately when the far end of the socket disappears.