byte[] bytes = new byte[8];
in.getBytes(0, bytes);
for (String protocol : protocolSet)
{
ProtocolManager protocolManager = protocolMap.get(protocol);
if (protocolManager.isProtocol(bytes))
{
protocolToUse = protocol;
break;
}
}
}
//if we get here we assume we use the core protocol as we match nothing else
if (protocolToUse == null)
{
protocolToUse = HornetQClient.DEFAULT_CORE_PROTOCOL;
}
ProtocolManager protocolManagerToUse = protocolMap.get(protocolToUse);
ConnectionCreator channelHandler = nettyAcceptor.createConnectionCreator();
ChannelPipeline pipeline = ctx.pipeline();
protocolManagerToUse.addChannelHandlers(pipeline);
pipeline.addLast("handler", channelHandler);
NettyServerConnection connection = channelHandler.createConnection(ctx, protocolToUse, httpEnabled);
protocolManagerToUse.handshake(connection, new ChannelBufferWrapper(in));
pipeline.remove(this);
ctx.flush();
}