public void SingleFileTorrent()
        {
            rig.Dispose();
            rig = TestRig.CreateSingleFile();
            string url = rig.Torrent.GetRightHttpSeeds[0];

            connection         = new HttpConnection(new Uri(url));
            connection.Manager = rig.Manager;

            id              = new PeerId(new Peer("this is my id", connection.Uri), rig.Manager);
            id.Connection   = connection;
            id.IsChoking    = false;
            id.AmInterested = true;
            id.BitField.SetAll(true);
            id.MaxPendingRequests = numberOfPieces;

            requests = rig.Manager.PieceManager.Picker.PickPiece(id, new List <PeerId>(), numberOfPieces);
            RecieveFirst();
            Assert.AreEqual(url, requestedUrl[0]);
        }
Пример #2
0
        public void Setup(bool metadataMode, string metadataPath)
        {
            pair             = new ConnectionPair(55432);
            rig              = TestRig.CreateSingleFile(1024 * 1024 * 1024, 32768, metadataMode);
            rig.MetadataPath = metadataPath;
            rig.RecreateManager();

            rig.Manager.HashChecked = true;
            rig.Manager.Start();
            rig.AddConnection(pair.Outgoing);

            var    connection = pair.Incoming;
            PeerId id         = new PeerId(new Peer("", connection.Uri), rig.Manager);

            id.Connection = connection;
            byte[] data;

            EncryptorFactory.EndCheckEncryption(EncryptorFactory.BeginCheckEncryption(id, 68, null, null, new InfoHash[] { id.TorrentManager.InfoHash }), out data);
            decryptor = id.Decryptor;
            encryptor = id.Encryptor;
        }
 public void Setup()
 {
     Rig = TestRig.CreateSingleFile(Piece.BlockSize * 20, Piece.BlockSize * 2);
     Rig.Manager.Bitfield.Not();
     Rig.Manager.Mode = new InitialSeedingMode(Rig.Manager);
 }