throw new IllegalArgumentException("Cannot create less than 1 peer");
}
Bindings bindings = new Bindings().addInterface("lo");
PeerDHT[] peers = new PeerDHT[nrOfPeers];
PeerBuilder pm = new PeerBuilder(new Number160(rnd))
.ports(port).enableMaintenance(maintenance)
.bindings(bindings);
peers[0] = new PeerBuilderDHT(pm.start()).start();
if(automaticFuture!=null) {
peers[0].peer().addAutomaticFuture(automaticFuture);
}
if(replication) {
IndirectReplication rep = new IndirectReplication(peers[0]);
if(rsync) {
rep.rsync().blockSize(32);
}
rep.nRoot().start();
}
for (int i = 1; i < nrOfPeers; i++) {
pm = new PeerBuilder(new Number160(rnd)).enableMaintenance(maintenance)
.bindings(bindings).masterPeer(peers[0].peer());
peers[i] = new PeerBuilderDHT(pm.start()).start();
if(automaticFuture!=null) {
peers[i].peer().addAutomaticFuture(automaticFuture);