Package net.tomp2p.p2p.builder

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


  private boolean bootstrap(Peer peer) throws UnknownHostException {
    // bootstrap
    InetAddress bootstrapTo = InetAddress.getLocalHost();
    BootstrapBuilder bootstrapBuilder = peer.bootstrap().inetAddress(bootstrapTo).ports(RELAY_START_PORT);
    BaseFuture bootstrap = bootstrapBuilder.start().awaitUninterruptibly();

    if (bootstrap == null) {
      LOG.error("Cannot bootstrap");
      return false;
    } else if (bootstrap.isFailed()) {
View Full Code Here


    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 {
        if (sender.peerId().equals(idP2)) {
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.