Beispiel #1
0
        public void Setup()
        {
            keys.Clear();

            listener.IncompleteAnnounce = listener.IncompleteScrape = false;

            server = new TrackerServer(trackerId)
            {
                AllowUnregisteredTorrents = true
            };
            server.RegisterListener(listener);
            client            = new HttpClient();
            trackerConnection = new HttpTrackerConnection(AnnounceUrl, client);
            tracker           = new Tracker(trackerConnection);

            var infoHashBytes = new[] { ' ', '%', '&', '?', '&', '&', '?', '5', '1', '=' }
            .Select(t => (byte)t);

            infoHash       = new InfoHash(infoHashBytes.Concat(infoHashBytes).ToArray());
            announceParams = new MonoTorrent.Trackers.AnnounceRequest(infoHash)
                             .WithPort(5555)
                             .WithPeerId(peerId.Span.ToArray());

            scrapeParams = new MonoTorrent.Trackers.ScrapeRequest(infoHash);
        }
Beispiel #2
0
 public void FixtureSetup()
 {
     listener = new HttpTrackerListener(uri.OriginalString);
     listener.Start();
     server = new TrackerServer();
     server.RegisterListener(listener);
     listener.Start();
 }
Beispiel #3
0
        public TrackerTestRig()
        {
            Tracker  = new TrackerServer();
            Listener = new CustomListener();
            Tracker.RegisterListener(Listener);

            GenerateTrackables();
            GeneratePeers();
        }
Beispiel #4
0
        public SimpleTorrentManager(ITrackable trackable, IPeerComparer comparer, TrackerServer tracker)
        {
            Comparer  = comparer;
            Trackable = trackable;
            Tracker   = tracker;

            Peers     = new Dictionary <object, Peer> ();
            PeersList = new List <Peer> ();
            Random    = new Random();
        }