handshaker = wsFactory.newHandshaker(req);
// Check if we can find the right handshaker for the requested version
if (handshaker == null) {
WebSocketServerHandshakerFactory.sendUnsupportedVersionResponse(ctx.channel());
} else {
handshaker.handshake(ctx.channel(), req).addListener(new ChannelFutureListener() {
@Override
public void operationComplete(ChannelFuture future) throws Exception {
if(!future.isSuccess()) {
// Handshake failed with an Exception, forward it to the other handlers in the chain
future.channel().pipeline().fireExceptionCaught(future.cause());