Ejemplo n.º 1
0
        public void Recipient_removes_length_field_based_decoder_from_pipeline_on_sending_ack()
        {
            NettyHandshakeHandler handler = new NettyHandshakeHandler(_service, _ip2PSession, HandshakeRole.Recipient, _remotePublicKey, _logger);

            handler.ChannelRead(_channelHandlerContext, Unpooled.Buffer(0, 0));

            _pipeline.Received(1).Remove <LengthFieldBasedFrameDecoder>();
        }
Ejemplo n.º 2
0
        public void Initiator_removes_length_field_based_decoder_from_pipeline_on_receiving_ack()
        {
            NettyHandshakeHandler handler = new NettyHandshakeHandler(_serializationService, _handshakeService, _session, HandshakeRole.Initiator, _logger, _group);

            handler.ChannelRead(_channelHandlerContext, Unpooled.Buffer(0, 0));

            _pipeline.Received(1).Remove <LengthFieldBasedFrameDecoder>();
        }
Ejemplo n.º 3
0
        public void Recipient_removes_itself_from_pipeline_on_sending_ack()
        {
            NettyHandshakeHandler handler = new NettyHandshakeHandler(_service, _ip2PSession, HandshakeRole.Recipient, _remotePublicKey, _logger);

            handler.ChannelRead(_channelHandlerContext, Unpooled.Buffer(0, 0));

            _pipeline.Received(1).Remove(handler);
        }
Ejemplo n.º 4
0
        public void Initiator_removes_itself_from_pipeline_on_receiving_ack()
        {
            NettyHandshakeHandler handler = new NettyHandshakeHandler(_serializationService, _handshakeService, _session, HandshakeRole.Initiator, _logger, _group);

            handler.ChannelRead(_channelHandlerContext, Unpooled.Buffer(0, 0));

            _pipeline.Received(1).Remove(handler);
        }
Ejemplo n.º 5
0
        public void Initator_removes_itself_from_pipeline_on_receiving_ack()
        {
            NettyHandshakeHandler handler = new NettyHandshakeHandler(_service, _ip2PSession, EncryptionHandshakeRole.Initiator, _remotePublicKey, _logger);

            handler.ChannelRead(_channelHandlerContext, Unpooled.Buffer(0, 0));

            _pipeline.Received(1).Remove(handler);
        }
Ejemplo n.º 6
0
        public void Initator_adds_framing_codecs_to_pipeline_on_receiving_ack()
        {
            NettyHandshakeHandler handler = new NettyHandshakeHandler(_service, _ip2PSession, HandshakeRole.Initiator, _remotePublicKey, _logger);

            handler.ChannelRead(_channelHandlerContext, Unpooled.Buffer(0, 0));

            _pipeline.Received(1).AddLast(Arg.Any <NettyPacketSplitter>());
            _pipeline.Received(1).AddLast(Arg.Any <NettyFrameMerger>());
        }
Ejemplo n.º 7
0
        public async Task Ignores_non_byte_buffer_input()
        {
            NettyHandshakeHandler handler = new NettyHandshakeHandler(_service, _ip2PSession, HandshakeRole.Recipient, _remotePublicKey, _logger);

            handler.ChannelRead(_channelHandlerContext, new object());

            _service.Received(0).Ack(Arg.Any <EncryptionHandshake>(), Arg.Any <Packet>());
            await _channelHandlerContext.Received(0).WriteAndFlushAsync(Arg.Any <object>());
        }
Ejemplo n.º 8
0
        public async Task Recipient_sends_ack_on_receiving_auth()
        {
            NettyHandshakeHandler handler = new NettyHandshakeHandler(_service, _ip2PSession, HandshakeRole.Recipient, _remotePublicKey, _logger);

            handler.ChannelRead(_channelHandlerContext, Unpooled.Buffer(0, 0));

            _service.Received(1).Ack(Arg.Any <EncryptionHandshake>(), Arg.Any <Packet>());
            await _channelHandlerContext.Received(1).WriteAndFlushAsync(Arg.Is <IByteBuffer>(b => Bytes.AreEqual(b.Array.Slice(0, NetTestVectors.AckEip8.Length), NetTestVectors.AckEip8)));
        }
Ejemplo n.º 9
0
        public void Recipient_adds_p2p_handlers_to_pipeline_on_sending_ack()
        {
            NettyHandshakeHandler handler = new NettyHandshakeHandler(_service, _ip2PSession, HandshakeRole.Recipient, _remotePublicKey, _logger);

            handler.ChannelRead(_channelHandlerContext, Unpooled.Buffer(0, 0));

            _pipeline.Received(1).AddLast(Arg.Any <NettyP2PHandler>());
            _pipeline.Received(1).AddLast(Arg.Any <PacketSender>());
        }
Ejemplo n.º 10
0
        public void Recipient_adds_frame_encryption_codecs_to_pipeline_on_sending_ack()
        {
            NettyHandshakeHandler handler = new NettyHandshakeHandler(_service, _ip2PSession, HandshakeRole.Recipient, _remotePublicKey, _logger);

            handler.ChannelRead(_channelHandlerContext, Unpooled.Buffer(0, 0));

            _pipeline.Received(1).AddLast(Arg.Any <NettyFrameEncoder>());
            _pipeline.Received(1).AddLast(Arg.Any <NettyFrameDecoder>());
        }
Ejemplo n.º 11
0
        public void Initiator_adds_frame_encryption_codecs_to_pipeline_on_receiving_ack()
        {
            NettyHandshakeHandler handler = new NettyHandshakeHandler(_serializationService, _handshakeService, _session, HandshakeRole.Initiator, _logger, _group);

            handler.ChannelRead(_channelHandlerContext, Unpooled.Buffer(0, 0));

            _pipeline.Received(1).AddLast(Arg.Any <ZeroFrameEncoder>());
            _pipeline.Received(1).AddLast(Arg.Any <ZeroFrameDecoder>());
        }
Ejemplo n.º 12
0
        public void Recipient_adds_p2p_handlers_to_pipeline_on_sending_ack()
        {
            NettyHandshakeHandler handler = new NettyHandshakeHandler(_serializationService, _handshakeService, _session, HandshakeRole.Recipient, _logger, _group);

            handler.ChannelRead(_channelHandlerContext, Unpooled.Buffer(0, 0));

            _pipeline.Received(1).AddLast(_group, Arg.Any <ZeroNettyP2PHandler>());
            _pipeline.Received(1).AddLast(Arg.Any <PacketSender>());
        }
        public void Recipient_adds_framing_codecs_to_pipeline_on_sending_ack()
        {
            NettyHandshakeHandler handler = new NettyHandshakeHandler(_service, _session, HandshakeRole.Recipient, _logger, _group);

            handler.ChannelRead(_channelHandlerContext, Unpooled.Buffer(0, 0));

            _pipeline.Received(1).AddLast(Arg.Any <NettyPacketSplitter>());
            _pipeline.Received(1).AddLast(Arg.Any <NettyFrameMerger>());
        }
        public void Initiator_adds_p2p_handlers_to_pipeline_on_receiving_ack()
        {
            NettyHandshakeHandler handler = new NettyHandshakeHandler(_service, _session, HandshakeRole.Initiator, _logger, _group);

            handler.ChannelRead(_channelHandlerContext, Unpooled.Buffer(0, 0));

            _pipeline.Received(1).AddLast(_group, Arg.Any <NettyP2PHandler>());
            _pipeline.Received(1).AddLast(Arg.Any <PacketSender>());
        }
Ejemplo n.º 15
0
        public void Initator_adds_p2p_handlers_to_pipeline_on_receiving_ack()
        {
            NettyHandshakeHandler handler = new NettyHandshakeHandler(_service, _ip2PSession, EncryptionHandshakeRole.Initiator, _remotePublicKey, _logger);

            handler.ChannelRead(_channelHandlerContext, Unpooled.Buffer(0, 0));

            _pipeline.Received(1).AddLast(Arg.Any <NettyP2PHandler>());
            _pipeline.Received(1).AddLast(Arg.Any <Multiplexor>());
        }