// 3 is good!
TrackerConfiguration tc = new TrackerConfiguration(1, 1, 20, 0, 20, 2);
Number160 trackerID = new Number160(rnd);
Set<Number160> tmp = new HashSet<Number160>();
for (int i = 0; i <= 300; i++) {
FutureTracker ft = nodes[300 + i].addTracker(trackerID)
.domainKey(Number160.createHash("test")).routingConfiguration(rc)
.trackerConfiguration(tc).start();
ft.awaitUninterruptibly();
System.err.println("added " + nodes[300 + i].peerAddress().peerId() + " on "
+ ft.directTrackers());
tmp.add(nodes[300 + i].peerAddress().peerId());
Assert.assertEquals(true, ft.isSuccess());
// Assert.assertEquals(true, ft.getDirectTrackers().size() == 2
// || ft.getDirectTrackers().size() == 3);
}
for (int i = 0; i <= 300; i++) {
FutureTracker ft = nodes[600 - i].addTracker(trackerID)
.domainKey(Number160.createHash("test")).routingConfiguration(rc)
.trackerConfiguration(tc).start();
ft.awaitUninterruptibly();
System.err.println("added " + nodes[300 + i].peerAddress().peerId() + " on "
+ ft.directTrackers());
tmp.add(nodes[600 - i].peerAddress().peerId());
Assert.assertEquals(true, ft.isSuccess());
// Assert.assertEquals(true, ft.getDirectTrackers().size() == 2
// || ft.getDirectTrackers().size() == 3);
}
tc = new TrackerConfiguration(1, 1, 30, 301, 0, 20);
FutureTracker ft1 = nodes[299].getTracker(trackerID).domainKey(Number160.createHash("test"))
.routingConfiguration(rc).trackerConfiguration(tc)
.evaluatingScheme(new VotingSchemeTracker()).start();
ft1.awaitUninterruptibly();
Assert.assertEquals(true, ft1.isSuccess());
for (TrackerData pa : ft1.trackers()) {
for (PeerStatistic pas : pa.peerAddresses().keySet()) {
System.err.println("found on DHT1: " + pas.peerAddress().peerId());
tmp.remove(pas.peerAddress().peerId());
}
}
// ctg.setUseSecondaryTrackers(true);
FutureTracker ft2 = nodes[299].getTracker(trackerID).domainKey(Number160.createHash("test"))
.routingConfiguration(rc).trackerConfiguration(tc)
.evaluatingScheme(new VotingSchemeTracker()).knownPeers(ft1.knownPeers())
.start();
ft2.awaitUninterruptibly();
System.err.println("Reason: " + ft2.failedReason());
Assert.assertEquals(true, ft2.isSuccess());
for (TrackerData pa : ft2.trackers()) {
for (PeerStatistic pas : pa.peerAddresses().keySet()) {
if (tmp.remove(pas.peerAddress().peerId()))
System.err.println("found on DHT2: " + pas.peerAddress().peerId());
}
}