if (!BaseServerWebSocket.class.isAssignableFrom(w.getClass())) {
throw new IllegalStateException();
}
BaseServerWebSocket webSocket = BaseServerWebSocket.class.cast(w);
webSocketProcessor = new WebSocketProcessor(config.getServlet(), new GrizzlyWebSocketSupport(webSocket));
try {
webSocketProcessor.connect(new HttpServletRequestWrapper(webSocket.getRequest()));
} catch (IOException e) {
logger.warn("failed to connect to web socket", e);
}
}