if (maxBinaryBufferSize != -1) session.setMaxBinaryMessageBufferSize(maxBinaryBufferSize);
if (webSocketWriteTimeout != -1) session.setMaxIdleTimeout(webSocketWriteTimeout);
if (maxTextBufferSize != -1) session.setMaxTextMessageBufferSize(maxTextBufferSize);
webSocket = new JSR356WebSocket(session, framework.getAtmosphereConfig());
Map<String, String> headers = new HashMap<String, String>();
for (Map.Entry<String, List<String>> e : handshakeRequest.getHeaders().entrySet()) {
headers.put(e.getKey(), e.getValue().size() > 0 ? e.getValue().get(0) : "");
}