Examples of FutureRelayNAT


Examples of net.tomp2p.nat.FutureRelayNAT

          .start();
      PeerNAT uNat = new PeerBuilderNAT(unreachablePeer.peer()).relayType(relayType).gcmServerCredentials(gcmServerCredentials).peerMapUpdateInterval(3).start();

      // bootstrap
      unreachablePeer.peer().bootstrap().peerAddress(master.peerAddress()).start();
      FutureRelayNAT fbn = uNat.startRelay(master.peerAddress()).awaitUninterruptibly();
      Assert.assertTrue(fbn.isSuccess());
      mockGCM(peers, uNat);

      // wait for maintenance to kick in
      Thread.sleep(4000);
View Full Code Here

Examples of net.tomp2p.nat.FutureRelayNAT

      }

      // Test setting up relay peers
      unreachablePeer1 = new PeerBuilderDHT(new PeerBuilder(Number160.createHash(rnd.nextInt())).ports(13337).start()).start();
      PeerNAT uNat1 = new PeerBuilderNAT(unreachablePeer1.peer()).relayType(relayType).gcmServerCredentials(gcmServerCredentials).peerMapUpdateInterval(3).start();
      FutureRelayNAT fbn1 = uNat1.startRelay(master.peerAddress()).awaitUninterruptibly();
      Assert.assertTrue(fbn1.isSuccess());

      unreachablePeer2 = new PeerBuilderDHT(new PeerBuilder(Number160.createHash(rnd.nextInt())).ports(13338).start()).start();
      PeerNAT uNat2 = new PeerBuilderNAT(unreachablePeer2.peer()).relayType(relayType).gcmServerCredentials(gcmServerCredentials).peerMapUpdateInterval(3).start();
      FutureRelayNAT fbn2 = uNat2.startRelay(master.peerAddress()).awaitUninterruptibly();
      Assert.assertTrue(fbn2.isSuccess());

      peers[8] = unreachablePeer1;
      peers[9] = unreachablePeer2;
      UtilsNAT.perfectRouting(peers);
     
View Full Code Here

Examples of net.tomp2p.nat.FutureRelayNAT

            
             // Test setting up relay peers
             unreachablePeer1 = new PeerBuilderDHT(new PeerBuilder(Number160.createHash(rnd.nextInt())).keyPair(pair1).ports(13337).start()).start();
             unreachablePeer1.peer().peerBean().serverPeerAddress(unreachablePeer1.peer().peerAddress().changeFirewalledTCP(true).changeFirewalledUDP(true));
             PeerNAT uNat1 = new PeerBuilderNAT(unreachablePeer1.peer()).relayType(relayType).gcmServerCredentials(gcmServerCredentials).peerMapUpdateInterval(3).start();
             FutureRelayNAT fbn1 = uNat1.startRelay(master.peerAddress()).awaitUninterruptibly();
             Assert.assertTrue(fbn1.isSuccess());

             unreachablePeer2 = new PeerBuilderDHT(new PeerBuilder(Number160.createHash(rnd.nextInt())).keyPair(pair2).ports(13338).start()).start();
             unreachablePeer2.peer().peerBean().serverPeerAddress(unreachablePeer2.peer().peerAddress().changeFirewalledTCP(true).changeFirewalledUDP(true));
             PeerNAT uNat2 = new PeerBuilderNAT(unreachablePeer2.peer()).relayType(relayType).gcmServerCredentials(gcmServerCredentials).peerMapUpdateInterval(3).start();
             FutureRelayNAT fbn2 = uNat2.startRelay(master.peerAddress()).awaitUninterruptibly();
             Assert.assertTrue(fbn2.isSuccess());

             peers[8] = unreachablePeer1;
       peers[9] = unreachablePeer2;
       UtilsNAT.perfectRouting(peers);
      
View Full Code Here

Examples of net.tomp2p.nat.FutureRelayNAT

      }

      // Test setting up relay peers
      unreachablePeer = new PeerBuilder(Number160.createHash(rnd.nextInt())).ports(13337).start();
      PeerNAT uNat = new PeerBuilderNAT(unreachablePeer).relayType(relayType).gcmServerCredentials(gcmServerCredentials).start();
      FutureRelayNAT fbn = uNat.startRelay(master.peerAddress()).awaitUninterruptibly();
      Assert.assertTrue(fbn.isSuccess());
      mockGCM(peers, uNat);

    } finally {
      if (master != null) {
        master.shutdown().await();
View Full Code Here

Examples of net.tomp2p.nat.FutureRelayNAT

            .senderId(gcmSenderId).registrationId(GCM_REGISTRATION_ID);
        builder.gcmServerCredentials(gcmCredentials);
      }

      PeerNAT peerNat = builder.start();
      FutureRelayNAT futureRelayNAT = peerNat.startRelay(relays.get(0).peer().peerAddress()).awaitUninterruptibly();
      if (!futureRelayNAT.isSuccess()) {
        LOG.error("Cannot connect to Relay(s). Reason: {}", futureRelayNAT.failedReason());
        return;
      }

      mobiles.add(peerNat);
      LOG.debug("Mobile peer {} connected to DHT and Relay(s)", i);
View Full Code Here

Examples of net.tomp2p.nat.FutureRelayNAT

    PeerNAT peerNAT = new PeerBuilderNAT(peer).start();
    PeerAddress pa = new PeerAddress(Number160.ZERO, InetAddress.getByName(ip), PORT_SERVER, PORT_SERVER);
   
    FutureDiscover fd = peer.discover().peerAddress(pa).start();
    FutureNAT fn = peerNAT.startSetupPortforwarding(fd);
    FutureRelayNAT frn = peerNAT.startRelay(fd, fn);
   
    frn.awaitUninterruptibly();
    if (fd.isSuccess()) {
      System.out.println("found that my outside address is " + fd.peerAddress());
    } else {
      System.out.println("failed " + fd.failedReason());
    }
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.