public void Setup() { pair = new ConnectionPair(55432); rig = TestRig.CreateMultiFile(); rig.Manager.HashChecked = true; rig.Manager.Start(); }
public void Setup() { requestedUrl.Clear(); partialData = false; int i; for (i = 0; i < 1000; i++) { try { listener = new HttpListener(); listener.Prefixes.Add(string.Format(listenerURL, i)); listener.Start(); break; } catch { } } listener.BeginGetContext(GotContext, null); rig = TestRig.CreateMultiFile(); connection = new HttpConnection(new Uri(string.Format(listenerURL, i))); 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); }
public void FixtureSetup() { rig = TestRig.CreateMultiFile(); id = new PeerId(new Peer(new string('a', 20), new Uri("tcp://BLAH")), rig.Manager); for (int i = 0; i < id.BitField.Length; i += 2) id.BitField[i] = true; }
public virtual void Setup() { // Yes, this is horrible. Deal with it. rig = TestRig.CreateMultiFile(); peers = new List<PeerId>(); picker = new IgnoringPicker(rig.Manager.Bitfield, new StandardPicker()); picker.Initialise(rig.Manager.Bitfield, rig.Manager.Torrent.Files, new List<Piece>()); peer = new PeerId(new Peer(new string('a', 20), new Uri("tcp://BLAH")), rig.Manager); for (int i = 0; i < 20; i++) { PeerId p = new PeerId(new Peer(new string(i.ToString()[0], 20), new Uri("tcp://" + i)), rig.Manager); p.SupportsFastPeer = true; peers.Add(p); } }
public void FixtureSetup() { string[][] trackers = new string[][] { new string [] { "custom://tracker1.com/announce", "custom://tracker2.com/announce", "custom://tracker3.com/announce", "custom://tracker4.com/announce" }, new string[] { "custom://tracker5.com/announce", "custom://tracker6.com/announce", "custom://tracker7.com/announce", "custom://tracker8.com/announce" } }; rig = TestRig.CreateTrackers(trackers); }
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 FixtureSetup() { buffer = new byte[100000]; testRig = TestRig.CreateMultiFile(); }
public void ReregisterManager() { ManualResetEvent handle = new ManualResetEvent(false); rig.Manager.TorrentStateChanged += delegate(object sender, TorrentStateChangedEventArgs e) { if (e.OldState == TorrentState.Hashing) handle.Set(); }; rig.Manager.HashCheck(false); handle.WaitOne(); handle.Reset(); rig.Engine.Unregister(rig.Manager); TestRig rig2 = new TestRig("", new TestWriter()); rig2.Engine.Unregister(rig2.Manager); rig.Engine.Register(rig2.Manager); rig2.Manager.TorrentStateChanged += delegate(object sender, TorrentStateChangedEventArgs e) { if (e.OldState == TorrentState.Hashing) handle.Set(); }; rig2.Manager.HashCheck(true); handle.WaitOne(); rig2.Dispose(); }
public void Setup() { Rig = TestRig.CreateSingleFile(Piece.BlockSize * 20, Piece.BlockSize * 2); Rig.Manager.Bitfield.Not (); Rig.Manager.Mode = new InitialSeedingMode(Rig.Manager); }
public void FixtureSetup() { rig = new TestRig(""); }
public void Setup() { rig = new TestRig("", new TestWriter()); conn = new ConnectionPair(51515); }
public void FixtureSetup() { rig = TestRig.CreateMultiFile(); id = new PeerId(new Peer(new string('a', 20), new Uri("tcp://BLAH")), rig.Manager); id.BitField.SetAll(true); }
public void FixtureSetup() { rig = TestRig.CreateMultiFile(); diskManager = rig.Engine.DiskManager; }
public void FixtureSetup() { buffer = new byte[100000]; testRig = new TestRig("Downloads"); }
public void GlobalSetup() { rig = TestRig.CreateMultiFile(); }
public void GlobalSetup() { rig = new TestRig("Downloads", PieceSize, null); }
public void Setup() { rig = TestRig.CreateMultiFile(new TestWriter()); conn = new ConnectionPair().WithTimeout(); }
public void Setup() { rig = TestRig.CreateMultiFile (new TestWriter()); conn = new ConnectionPair(51515); }
public void FixtureSetup() { rig = TestRig.CreateMultiFile(); }
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]); }
public void Setup() { rig = TestRig.CreateMultiFile(new TestWriter()); conn = new ConnectionPair(51515); }
public void FixtureSetup() { rig = TestRig.CreateMultiFile(); id = new PeerId(new Peer("peerid", new Uri("tcp://weburl.com")), rig.Manager); other = new PeerId(new Peer("other", new Uri("tcp://other.com")), rig.Manager); }
public void Setup() { pair = new ConnectionPair(55432); rig = new TestRig(""); rig.Manager.Start(); }
public void Setup() { Rig = TestRig.CreateSingleFile(Piece.BlockSize * 20, Piece.BlockSize * 2); Rig.Manager.Bitfield.Not(); Rig.Manager.Mode = new InitialSeedingMode(Rig.Manager); }