예제 #1
0
        public async Task sending_ping_recieving_incorect_pong_does_not_bond()
        {
            var node        = new Node(_host, _port);
            var nodeManager = new NodeLifecycleManager(node, _discoveryManagerMock
                                                       , _nodeTable, new DiscoveryMessageFactory(_timestamper), _evictionManagerMock, _nodeStatsMock, _discoveryConfigMock, _loggerMock);

            PingMessage sentPing = new PingMessage();

            _discoveryManagerMock.SendMessage(Arg.Do <PingMessage>(msg => sentPing = msg));

            await nodeManager.SendPingAsync();

            nodeManager.ProcessPongMessage(new PongMessage {
                PingMdc = new byte[] { 1, 1, 1 }
            });

            Assert.IsFalse(nodeManager.IsBonded);
        }
예제 #2
0
        public async Task sending_ping_recieving_proper_pong_sets_bounded()
        {
            var node        = new Node(_host, _port);
            var nodeManager = new NodeLifecycleManager(node, _discoveryManagerMock
                                                       , _nodeTable, new DiscoveryMessageFactory(_timestamper), _evictionManagerMock, _nodeStatsMock, _discoveryConfigMock, _loggerMock);

            var sentPing = new PingMessage();

            _discoveryManagerMock.SendMessage(Arg.Do <PingMessage>(msg => sentPing = msg));

            await nodeManager.SendPingAsync();

            nodeManager.ProcessPongMessage(new PongMessage {
                PingMdc = sentPing.Mdc
            });

            Assert.IsTrue(nodeManager.IsBonded);
        }