Package net.tomp2p.futures

Examples of net.tomp2p.futures.FutureBootstrap.bootstrapTo()


               
                //bootstrap
                FutureBootstrap fb = peer.bootstrap().peerAddress(masterNodeAddress).start();
                fb.awaitUninterruptibly();
                if (fb.isSuccess()) {
                  log.info("Bootstrap with direct connection successful. Address = " + fb.bootstrapTo());
                  return peer;
                } else {
                  return null;
                }
            }
View Full Code Here


  public ExampleDNS(int nodeId) throws Exception {
    peer = new PeerBuilderDHT(new PeerBuilder(Number160.createHash(nodeId)).ports(4000 + nodeId).start()).start();
    FutureBootstrap fb = this.peer.peer().bootstrap().broadcast(true).ports(4001).start();
    fb.awaitUninterruptibly();
    if(fb.isSuccess()) {
      peer.peer().discover().peerAddress(fb.bootstrapTo().iterator().next()).start().awaitUninterruptibly();
    }
  }

  public static void main(String[] args) throws NumberFormatException, Exception {
    ExampleDNS dns = new ExampleDNS(Integer.parseInt(args[0]));
View Full Code Here

            Assert.fail();
            return null;
        }
        final FutureBootstrap fb = peer.bootstrap().broadcast().ports(seed.peerAddress().udpPort()).start();
        fb.awaitUninterruptibly();
        peer.discover().peerAddress(fb.bootstrapTo().iterator().next()).start();
        fb.addListener(new BaseFutureListener<BaseFuture>() {
            @Override
            public void operationComplete(BaseFuture future) throws Exception {
                Collection<PeerAddress> addresses = fb.bootstrapTo();
                if (addresses != null && !addresses.isEmpty()) {
View Full Code Here

        fb.awaitUninterruptibly();
        peer.discover().peerAddress(fb.bootstrapTo().iterator().next()).start();
        fb.addListener(new BaseFutureListener<BaseFuture>() {
            @Override
            public void operationComplete(BaseFuture future) throws Exception {
                Collection<PeerAddress> addresses = fb.bootstrapTo();
                if (addresses != null && !addresses.isEmpty()) {
                    peer.discover().peerAddress(addresses.iterator().next()).start().awaitUninterruptibly();
                } else {
                    Assert.assertTrue("Unable to boostrap to peers in the network", false);
                }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.