Hi Petr,
One possible solution would be to pass a kind of session factory object to the ctor of TrackerManager. When testing you would pass a mocked factory that returns mock objects and when the component is integrated it would use a real factory.
There is actually a benefit of using this approach - TrackerManager will be decoupled from the TrackerRequestSession implementation - it would only need to know an interface - and if we ever have an alternative way of requesting peers for a torrent we could create a different implementation and use it without having to touch TrackerManager. Now that I thought about it, that is exactly the case that we have! Hopefully in the near future we will start implementing DHT, so if should be possible to request peers from the DHT network. The TrackerManager would ideally stay the same and we would only extend the session factory to return a DhtRequestSession when necessary.
Regards,
Peter
