protected override void Decode(IChannelHandlerContext context, IByteBuffer input, List <object> output) { if (input.ReadableBytes < 4) { return; } input.MarkReaderIndex(); int dataLength = input.ReadInt(); if (input.ReadableBytes < dataLength) { input.ResetReaderIndex(); return; } byte[] data = new byte[dataLength]; input.ReadBytes(data); NetCommand command = NetCommand.Deserialize(data); output.Add(command); }