if (url.getQuery() != null && url.getQuery().length() > 0) {
path = url.getPath() + "?" + url.getQuery();
}
HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, path);
request.headers().add(Names.UPGRADE, Values.WEBSOCKET);
request.headers().add(Names.CONNECTION, Values.UPGRADE);
request.headers().add(Names.HOST, url.getHost());
request.headers().add(Names.ORIGIN, "http://" + url.getHost());
event.getChannel().write(request);
ctx.getPipeline().replace("encoder", "ws-encoder", new WebSocket00FrameEncoder());
this.channel = event.getChannel();