public async Task DoNotBroadcastToSourcePeer()
        {
            TestTransport transportA = CreateTestTransport(new PrivateKey());
            TestTransport transportB = CreateTestTransport(new PrivateKey());
            TestTransport transportC = CreateTestTransport(new PrivateKey());

            await StartTestTransportAsync(transportA);
            await StartTestTransportAsync(transportB);
            await StartTestTransportAsync(transportC);

            try
            {
                await transportA.AddPeersAsync(new[] { transportB.AsPeer }, null);

                await transportB.AddPeersAsync(new[] { transportC.AsPeer }, null);

                transportA.BroadcastTestMessage(null, "foo");
                await transportC.WaitForTestMessageWithData("foo");

                await Task.Delay(100);

                Assert.True(transportC.ReceivedTestMessageOfData("foo"));
                Assert.False(transportA.ReceivedTestMessageOfData("foo"));
            }
            finally
            {
                transportA.Dispose();
                transportB.Dispose();
                transportC.Dispose();
            }
        }
        public async Task RefreshTable()
        {
            const int peersCount  = 10;
            var       privateKey  = new PrivateKey();
            var       privateKeys = Enumerable.Range(0, peersCount).Select(
                i => GeneratePrivateKeyOfBucketIndex(privateKey.ToAddress(), i / 2));
            TestTransport transport = CreateTestTransport(privateKey);

            TestTransport[] transports =
                privateKeys.Select(key => CreateTestTransport(key)).ToArray();

            await StartTestTransportAsync(transport);

            foreach (var t in transports)
            {
                await StartTestTransportAsync(t);
            }

            try
            {
                foreach (var t in transports)
                {
                    transport.Table.AddPeer(
                        (BoundPeer)t.AsPeer,
                        DateTimeOffset.UtcNow - TimeSpan.FromMinutes(2));
                }

                IReadOnlyList <BoundPeer> refreshCandidates =
                    transport.Table.PeersToRefresh(TimeSpan.FromMinutes(1));
                Assert.Equal(peersCount, transport.Peers.Count());
                Assert.Equal(peersCount / 2, refreshCandidates.Count);
                Assert.Equal(peersCount / 2, transport.Table.NonEmptyBuckets.Count());

                await transport.Protocol.RefreshTableAsync(TimeSpan.FromMinutes(1), default);

                Assert.NotEqual(
                    refreshCandidates.ToHashSet(),
                    transport.Table.PeersToRefresh(TimeSpan.FromMinutes(1)).ToHashSet());
                Assert.Equal(
                    peersCount / 2,
                    transport.Table.PeersToRefresh(TimeSpan.FromMinutes(1)).Count());
                Assert.Equal(peersCount / 2, transport.Table.NonEmptyBuckets.Count());

                await transport.Protocol.RefreshTableAsync(TimeSpan.FromMinutes(1), default);

                Assert.Empty(transport.Table.PeersToRefresh(TimeSpan.FromMinutes(1)));
            }
            finally
            {
                transport.Dispose();
                foreach (var t in transports)
                {
                    t.Dispose();
                }
            }
        }