public static ChannelPipe CreateChannelPipe(IPacketEncoder encoder, IPacketDecoder decoder, IChannelHandler handler) { var pipe = new ChannelPipe(); pipe.SetCreateChannelAction((channel) => { channel.SetConfig("encoder", encoder); channel.SetConfig("decoder", decoder); channel.SetConfig("handler", handler); }); return pipe; }
private static void SetFactoryOption(ChannelPipe pipe) { PacketEncoder encoder = new PacketEncoder(); pipe.SetProtocol(() => new ModifiableProtocol(encoder: encoder, decoder: encoder)); pipe.SetHandler(() => Handler); }