Ejemplo n.º 1
0
        public void Can_enable_snappy()
        {
            Session session = new Session(30312, LimboLogs.Instance, _channel, new Node("127.0.0.1", 8545));

            session.Handshake(TestItem.PublicKeyA);
            session.Init(5, _channelHandlerContext, _packetSender);
            session.EnableSnappy();
            _pipeline.Received().Get <NettyPacketSplitter>();
            _pipeline.Received().AddBefore(Arg.Any <string>(), Arg.Any <string>(), Arg.Any <SnappyDecoder>());
            _pipeline.Received().AddBefore(Arg.Any <string>(), Arg.Any <string>(), Arg.Any <SnappyEncoder>());
        }
Ejemplo n.º 2
0
 public void Can_enable_snappy()
 {
     Session session = new(30312, new Node(TestItem.PublicKeyA, "127.0.0.1", 8545), _channel, NullDisconnectsAnalyzer.Instance, LimboLogs.Instance);
     ZeroNettyP2PHandler handler = new(session, LimboLogs.Instance);
     _pipeline.Get<ZeroNettyP2PHandler>().Returns(handler);
     Assert.False(handler.SnappyEnabled);
     session.Handshake(TestItem.PublicKeyA);
     session.Init(5, _channelHandlerContext, _packetSender);
     session.EnableSnappy();
     Assert.True(handler.SnappyEnabled);
     _pipeline.Received().Get<ZeroPacketSplitter>();
     _pipeline.Received().AddBefore(Arg.Any<string>(), Arg.Any<string>(), Arg.Any<ZeroSnappyEncoder>());
 }
Ejemplo n.º 3
0
        public void Initator_adds_frame_encryption_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 <NettyFrameEncoder>());
            _pipeline.Received(1).AddLast(Arg.Any <NettyFrameDecoder>());
        }
Ejemplo n.º 4
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>());
        }