コード例 #1
0
        public void Stops_delivering_messages_after_disconnect()
        {
            Session session = new(30312, new Node(TestItem.PublicKeyA, "127.0.0.1", 8545), _channel, NullDisconnectsAnalyzer.Instance, LimboLogs.Instance);
            session.Handshake(TestItem.PublicKeyA);
            session.Init(5, _channelHandlerContext, _packetSender);
            IProtocolHandler p2p = BuildHandler("p2p", 10);
            session.AddProtocolHandler(p2p);

            session.InitiateDisconnect(DisconnectReason.Other);

            session.DeliverMessage(PingMessage.Instance);
            _packetSender.DidNotReceive().Enqueue(Arg.Any<PingMessage>());
        }
コード例 #2
0
ファイル: P2PSessionTests.cs プロジェクト: FIVIL/nethermind
        public void Stops_delivering_messages_after_disconnect()
        {
            Session session = new Session(30312, LimboLogs.Instance, _channel, new Node("127.0.0.1", 8545));

            session.Handshake(TestItem.PublicKeyA);
            session.Init(5, _channelHandlerContext, _packetSender);
            IProtocolHandler p2p = BuildHandler("p2p", 10);

            session.AddProtocolHandler(p2p);

            session.InitiateDisconnect(DisconnectReason.Other);

            session.DeliverMessage(new Packet("p2p", 3, Bytes.Empty));
            _packetSender.DidNotReceive().Enqueue(Arg.Is <Packet>(p => p.Protocol == "p2p" && p.PacketType == 3));
        }