Beispiel #1
0
 private static void ApplyChannelPipeline(IChannel channel, IChannelHandler handler)
 {
     var encoders = new IChannelHandler[]
     {new LengthFieldPrepender(4, false), new LengthFieldBasedFrameDecoder(10000, 0, 4, 0, 4)};
     var protobuf = new IChannelHandler[] { new ProtobufEncoder(), new ProtobufDecoder(TCP.Wrapper.DefaultInstance) };
     var msg = new IChannelHandler[] { new MsgEncoder(), new MsgDecoder() };
     var pipeline = encoders.Concat(protobuf).Concat(msg).Concat(new IChannelHandler[] { handler });
     foreach (var h in pipeline)
         channel.Pipeline.AddLast(h);
 }
Beispiel #2
0
        private static void ApplyChannelPipeline(IChannel channel, IChannelHandler handler)
        {
            var encoders = new IChannelHandler[]
            { new LengthFieldPrepender(4, false), new LengthFieldBasedFrameDecoder(10000, 0, 4, 0, 4) };
            var protobuf = new IChannelHandler[] { new ProtobufEncoder(), new ProtobufDecoder(TCP.Wrapper.DefaultInstance) };
            var msg      = new IChannelHandler[] { new MsgEncoder(), new MsgDecoder() };
            var pipeline = encoders.Concat(protobuf).Concat(msg).Concat(new IChannelHandler[] { handler });

            foreach (var h in pipeline)
            {
                channel.Pipeline.AddLast(h);
            }
        }
Beispiel #3
0
        private static void ApplyChannelPipeline(IChannel channel, IChannelHandler handler)
        {
            var encoders = new IChannelHandler[]
            { new LengthFieldPrepender(ByteOrder.LittleEndian, 4, 0, false), new LengthFieldBasedFrameDecoder(ByteOrder.LittleEndian, 10000, 0, 4, 0, 4, true) };
            var protobuf = new IChannelHandler[] { new ProtobufEncoder(), new ProtobufDecoder(Proto.Msg.Wrapper.Parser) };
            var msg      = new IChannelHandler[] { new MsgEncoder(), new MsgDecoder() };
            var pipeline = encoders.Concat(protobuf).Concat(msg);

            foreach (var h in pipeline)
            {
                channel.Pipeline.AddLast(h);
            }
            channel.Pipeline.AddLast("TestKitHandler", handler);
        }