final GrizzlyWebSocketAdapter webSocketAdapter = createWebSocketAdapter(context);
context.setWebSocket(webSocketAdapter);
SimpleWebSocket ws = webSocketAdapter.getGrizzlyWebSocket();
if (context.getCurrentState() == UPGRADE) {
httpHeader.setChunked(false);
ws.onConnect();
WebSocketHolder.set(ctx.getConnection(), context.getProtocolHandler(), ws);
((WebSocketUpgradeHandler) context.getHandler()).onSuccess(context.getWebSocket());
final int wsTimeout = context.getProvider().getClientConfig().getWebSocketTimeout();
IdleTimeoutFilter.setCustomTimeout(ctx.getConnection(), ((wsTimeout <= 0) ? IdleTimeoutFilter.FOREVER : wsTimeout),
TimeUnit.MILLISECONDS);