public async Task Will_remove_peer_if_times_out_on_init()
        {
            var peer = new SimpleSyncPeerMock(TestItem.PublicKeyA);

            peer.SetHeaderResponseTime(int.MaxValue);
            _pool.Start();
            _pool.AddPeer(peer);

            await WaitFor(() => peer.DisconnectRequested);

            Assert.True(peer.DisconnectRequested);
        }
        public async Task Can_remove_during_init()
        {
            var peer = new SimpleSyncPeerMock(TestItem.PublicKeyA);

            peer.SetHeaderResponseTime(500);
            _pool.Start();
            _pool.AddPeer(peer);

            var allocation = await _pool.Allocate(new BySpeedStrategy(TransferSpeedType.Headers, true));

            _pool.RemovePeer(peer);

            Assert.AreEqual(null, allocation.Current);
            Assert.AreEqual(0, _pool.PeerCount);
        }
        public async Task Can_remove_during_init()
        {
            var peer = new SimpleSyncPeerMock(TestItem.PublicKeyA);

            peer.SetHeaderResponseTime(500);
            _pool.Start();
            _pool.AddPeer(peer);

            var allocation = await _pool.BorrowAsync(BySpeedSelectionStrategy.Fastest);

            _pool.RemovePeer(peer);

            Assert.AreEqual(null, allocation.Current);
            Assert.AreEqual(0, _pool.PeerCount);
        }
        public async Task Will_remove_peer_if_times_out_on_init()
        {
            var peer = new SimpleSyncPeerMock(TestItem.PublicKeyA);

            peer.SetHeaderResponseTime(20000);

            _pool.Start();
            _pool.AddPeer(peer);
            await Task.Delay(12000);


            var allocation = _pool.Borrow();

            Assert.AreEqual(null, allocation.Current);
            Assert.True(peer.DisconnectRequested);
        }
        public async Task Can_remove_during_init()
        {
            var peer = new SimpleSyncPeerMock(TestItem.PublicKeyA);

            peer.SetHeaderResponseTime(1000);

            _pool.Start();
            _pool.AddPeer(peer);
            await Task.Delay(200);

            var allocation = _pool.Borrow();

            _pool.RemovePeer(peer);
            await Task.Delay(1000);

            Assert.AreEqual(null, allocation.Current);
            Assert.AreEqual(0, _pool.PeerCount);
        }