use of de.datasecs.hydra.shared.handler.HydraSession in project Hydra by DataSecs.
the class HydraChannelInitializer method initChannel.
@Override
protected void initChannel(SocketChannel channel) {
ChannelPipeline pipeline = channel.pipeline();
// In
pipeline.addLast(new LengthFieldBasedFrameDecoder(Integer.MAX_VALUE, 0, 4));
pipeline.addLast(new PacketDecoder(protocol));
// Out
pipeline.addLast(new LengthFieldPrepender(4));
pipeline.addLast(new PacketEncoder(protocol));
HydraSession session = new HydraSession(channel, protocol);
pipeline.addLast(session);
// Add sessions to protocol, to keep track of them
if (isServer) {
protocol.addSession(session);
} else {
protocol.setClientSession(session);
}
// Inform SessionListener about new session
protocol.callSessionListener(true, session);
}
Aggregations