String upgradeHeader = req.getHeader("Upgrade");
if(upgradeHeader != null && upgradeHeader.toUpperCase().equals("WEBSOCKET")){
Logger.getLogger(WebsockifyProxyHandler.class.getName()).fine("Websocket request from " + e.getRemoteAddress() + ".");
// Handshake
WebSocketServerHandshakerFactory wsFactory = new WebSocketServerHandshakerFactory(
this.getWebSocketLocation(req), "base64", false);
this.handshaker = wsFactory.newHandshaker(req);
if (this.handshaker == null) {
wsFactory.sendUnsupportedWebSocketVersionResponse(ctx.getChannel());
} else {
// deal with a bug in the flash websocket emulation
// it specifies WebSocket-Protocol when it seems it should specify Sec-WebSocket-Protocol
String protocol = req.getHeader("WebSocket-Protocol");
String secProtocol = req.getHeader("Sec-WebSocket-Protocol");