final int nr1 = 1;
final int port2 = 4002;
final int nr2 = 2;
final int port3 = 4003;
final int nr3 = 4;
PeerDHT peer1 = new PeerBuilderDHT(new PeerBuilder(new Number160(nr1)).ports(port1).start()).start();
PeerDHT peer2 = new PeerBuilderDHT(new PeerBuilder(new Number160(nr2)).ports(port2).start()).start();
PeerDHT peer3 = new PeerBuilderDHT(new PeerBuilder(new Number160(nr3)).ports(port3).start()).start();
new IndirectReplication(peer1).start();
new IndirectReplication(peer2).start();
new IndirectReplication(peer3).start();
PeerDHT[] peers = new PeerDHT[] {peer1, peer2, peer3};
//
FuturePut futurePut = peer1.put(new Number160(nr3)).data(new Data("store on peer1")).start();
futurePut.awaitUninterruptibly();
FutureDigest futureDigest = peer1.digest(new Number160(nr3)).start();
futureDigest.awaitUninterruptibly();
System.out.println("we found the data on " + futureDigest.rawDigest().size() + " peers");
// now peer1 gets to know peer2, transfer the data
peer1.peer().bootstrap().peerAddress(peer2.peerAddress()).start();
peer1.peer().bootstrap().peerAddress(peer3.peerAddress()).start();
Thread.sleep(ONE_SECOND);
futureDigest = peer1.digest(new Number160(nr3)).start();
futureDigest.awaitUninterruptibly();
System.out.println("we found the data on " + futureDigest.rawDigest().size() + " peers");
shutdown(peers);
}