DefaultFullHttpRequest request = (DefaultFullHttpRequest) msg;
HttpHeaders headers = request.headers();
String upgrade = headers.get("upgrade");
if (upgrade != null && upgrade.equalsIgnoreCase("websocket"))
{
ctx.pipeline().addLast("websocket-handler", new WebSocketServerHandler());
ctx.pipeline().addLast(new ProtocolDecoder(false, false));
ctx.pipeline().remove(this);
ctx.pipeline().remove("http-handler");
ctx.fireChannelRead(msg);
}