Package net.tomp2p.p2p

Examples of net.tomp2p.p2p.PeerMaker


    TomP2P_Peer p = new TomP2P_Peer();

    Random r = new Random();
    final Peer peer;
    try {
      peer = new PeerMaker(new Number160(r)).setPorts(port)
          .makeAndListen();

      PeerAddress pa = new PeerAddress(Number160.ZERO, masterPeerAddress,
          masterPeerPort, masterPeerPort);
      logger.info(String.format("Client-Node connecting to master: %s",
View Full Code Here


    Random r = new Random();
    final Peer peer;
    try {

      if (masterPeer != null) {
        peer = new PeerMaker(new Number160(r)).setPorts(port)
            .makeAndListen();
        FutureBootstrap res = peer.bootstrap()
            .setPeerAddress(masterPeer.getPeerAddress()).start();
        res.awaitUninterruptibly();

      } else
        peer = new PeerMaker(new Number160(r)).setPorts(port)
            .makeAndListen();

      // Only if using the internet:
      // peer.getConfiguration().setBehindFirewall(true);
    } catch (java.net.BindException
View Full Code Here

    beforeClass();
  }

  @Test
  public void getFromToTest1() throws IOException, ClassNotFoundException {
    Peer p1 = new PeerMaker(Number160.createHash(1)).setEnableIndirectReplication(true).ports(4838)
        .makeAndListen();
    Peer p2 = new PeerMaker(Number160.createHash(2)).setEnableIndirectReplication(true).masterPeer(p1)
        .makeAndListen();

    p2.bootstrap().setPeerAddress(p1.getPeerAddress()).start().awaitUninterruptibly();

    String locationKey = "location";
View Full Code Here

    p2.shutdown().awaitUninterruptibly();
  }

  @Test
  public void getFromToTest2() throws IOException, ClassNotFoundException, InterruptedException {
    Peer p1 = new PeerMaker(Number160.createHash(1)).setEnableIndirectReplication(true).ports(4838)
        .makeAndListen();
    Peer p2 = new PeerMaker(Number160.createHash(2)).setEnableIndirectReplication(true).masterPeer(p1)
        .makeAndListen();

    p2.bootstrap().setPeerAddress(p1.getPeerAddress()).start().awaitUninterruptibly();
    p1.bootstrap().setPeerAddress(p2.getPeerAddress()).start().awaitUninterruptibly();
View Full Code Here

    p2.shutdown().awaitUninterruptibly();
  }

  @Test
  public void removeFromToTest1() throws IOException, ClassNotFoundException {
    Peer p1 = new PeerMaker(Number160.createHash(1)).setEnableIndirectReplication(true).ports(5000)
        .makeAndListen();
    Peer p2 = new PeerMaker(Number160.createHash(2)).setEnableIndirectReplication(true).masterPeer(p1)
        .makeAndListen();

    p2.bootstrap().setPeerAddress(p1.getPeerAddress()).start().awaitUninterruptibly();

    String locationKey = "location";
View Full Code Here

    p2.shutdown().awaitUninterruptibly();
  }

  @Test
  public void removeFromToTest2() throws IOException, ClassNotFoundException {
    Peer p1 = new PeerMaker(Number160.createHash(1)).setEnableIndirectReplication(true).ports(5000)
        .makeAndListen();
    Peer p2 = new PeerMaker(Number160.createHash(2)).setEnableIndirectReplication(true).masterPeer(p1)
        .makeAndListen();

    p2.bootstrap().setPeerAddress(p1.getPeerAddress()).start().awaitUninterruptibly();

    String locationKey = "location";
View Full Code Here

    p2.shutdown().awaitUninterruptibly();
  }

  @Test
  public void removeTest() throws IOException, ClassNotFoundException {
    Peer p1 = new PeerMaker(Number160.createHash(1)).setEnableIndirectReplication(true).ports(5000)
        .makeAndListen();
    Peer p2 = new PeerMaker(Number160.createHash(2)).setEnableIndirectReplication(true).masterPeer(p1)
        .makeAndListen();

    p2.bootstrap().setPeerAddress(p1.getPeerAddress()).start().awaitUninterruptibly();

    String locationKey = "location";
View Full Code Here

    p2.shutdown().awaitUninterruptibly();
  }

  @Test
  public void removeFromToTest3() throws IOException, ClassNotFoundException {
    Peer p1 = new PeerMaker(Number160.createHash(1)).setEnableIndirectReplication(true).ports(5000)
        .makeAndListen();
    Peer p2 = new PeerMaker(Number160.createHash(2)).setEnableIndirectReplication(true).masterPeer(p1)
        .makeAndListen();

    p2.bootstrap().setPeerAddress(p1.getPeerAddress()).start().awaitUninterruptibly();
    p1.bootstrap().setPeerAddress(p2.getPeerAddress()).start().awaitUninterruptibly();
View Full Code Here

    p2.shutdown().awaitUninterruptibly();
  }

  @Test
  public void removeFromToTest4() throws IOException, ClassNotFoundException {
    Peer p1 = new PeerMaker(Number160.createHash(1)).setEnableIndirectReplication(true).ports(5000)
        .makeAndListen();
    Peer p2 = new PeerMaker(Number160.createHash(2)).setEnableIndirectReplication(true).masterPeer(p1)
        .makeAndListen();

    p2.bootstrap().setPeerAddress(p1.getPeerAddress()).start().awaitUninterruptibly();
    p1.bootstrap().setPeerAddress(p2.getPeerAddress()).start().awaitUninterruptibly();
View Full Code Here

    p2.shutdown().awaitUninterruptibly();
  }

  @Test
  public void digestFromToTest() throws IOException, ClassNotFoundException {
    Peer p1 = new PeerMaker(Number160.createHash(1)).setEnableIndirectReplication(true).ports(5000)
        .makeAndListen();
    Peer p2 = new PeerMaker(Number160.createHash(2)).setEnableIndirectReplication(true).masterPeer(p1)
        .makeAndListen();

    p2.bootstrap().setPeerAddress(p1.getPeerAddress()).start().awaitUninterruptibly();

    String locationKey = "location";
View Full Code Here

TOP

Related Classes of net.tomp2p.p2p.PeerMaker

Copyright © 2018 www.massapicom. 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.