Examples of bootstrapTo()


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

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

  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

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

            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

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

        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

Examples of net.tomp2p.p2p.builder.BootstrapBuilder.bootstrapTo()

    final Number160 idP1 = Number160.createHash("p1");
    final Number160 idP2 = Number160.createHash("p2");
    PeerDHT p1 = new PeerBuilderDHT(new PeerBuilder(idP1).ports(1234).start()).start();
    PeerDHT p2 = new PeerBuilderDHT(new PeerBuilder(idP2).ports(1235).start()).start();
    BootstrapBuilder b = p2.peer().bootstrap();
    b.bootstrapTo(Arrays.asList(new PeerAddress(idP1, "localhost", 1234, 1234)));
    b.start().awaitUninterruptibly();

    p1.peer().objectDataReply(new ObjectDataReply() {
      @Override
      public Object reply(PeerAddress sender, Object request) throws Exception {
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.