Beispiel #1
0
        protected internal override void Decode(ChannelHandlerContext ctx, ByteBuf @in, IList <object> @out)
        {
            int messageCode = @in.readInt();

            switch (messageCode)
            {
            case InitialMagicMessage.MESSAGE_CODE:
            {
                string magic = StringMarshal.unmarshal(@in);
                @out.Add(new InitialMagicMessage(magic));
                return;
            }

            case 1:
            {
//JAVA TO C# CONVERTER TODO TASK: Method reference constructor syntax is not converted by Java to C# Converter:
                ApplicationProtocolRequest applicationProtocolRequest = DecodeProtocolRequest(ApplicationProtocolRequest::new, @in, ByteBuf.readInt);
                @out.Add(applicationProtocolRequest);
                return;
            }

            case 2:
//JAVA TO C# CONVERTER TODO TASK: Method reference constructor syntax is not converted by Java to C# Converter:
                ModifierProtocolRequest modifierProtocolRequest = DecodeProtocolRequest(ModifierProtocolRequest::new, @in, StringMarshal.unmarshal);
                @out.Add(modifierProtocolRequest);
                return;

            case 3:
            {
                string protocolName = StringMarshal.unmarshal(@in);
                int    version      = @in.readInt();
                int    numberOfModifierProtocols = @in.readInt();
                IList <Pair <string, string> > modifierProtocols = Stream.generate(() => Pair.of(StringMarshal.unmarshal(@in), StringMarshal.unmarshal(@in))).limit(numberOfModifierProtocols).collect(Collectors.toList());
                @out.Add(new SwitchOverRequest(protocolName, version, modifierProtocols));
                return;
            }

            default:
                // TODO
                return;
            }
        }