connectionMap.put(channel, socket);
// remove old http handlers and replace the old handler with one that handle plain sockets
channel.pipeline().remove("httpDecoder");
channel.pipeline().remove("chunkedWriter");
channel.pipeline().replace("handler", "handler", new VertxNetHandler(server.vertx, connectionMap) {
@Override
public void exceptionCaught(ChannelHandlerContext chctx, Throwable t) throws Exception {
// remove from the real mapping
server.connectionMap.remove(channel);
super.exceptionCaught(chctx, t);