@Override protected void doStop() throws Exception { if (websocket != null && websocket.isOpen()) { if (LOG.isDebugEnabled()) { LOG.debug("Disconnecting from {}", getHttpUri().toASCIIString()); } websocket.removeWebSocketListener(listener); websocket.sendCloseFrame(); websocket = null; } super.doStop(); }