Package net.tomp2p.connection

Examples of net.tomp2p.connection.Bindings


    public static PeerDHT[] createNodesDHT(int nrOfPeers, Random rnd, int port, AutomaticFuture automaticFuture,
            boolean maintenance) throws Exception {
        if (nrOfPeers < 1) {
            throw new IllegalArgumentException("Cannot create less than 1 peer");
        }
        Bindings bindings = new Bindings();// .addInterface("lo");
        PeerDHT[] peers = new PeerDHT[nrOfPeers];
        final Peer master;
        if (automaticFuture != null) {
          Number160 peerId = new Number160(rnd);
          PeerMap peerMap = new PeerMap(new PeerMapConfiguration(peerId));
View Full Code Here


            boolean maintenance) throws Exception {
        if (nrOfPeers < 1) {
            throw new IllegalArgumentException("Cannot create less than 1 peer");
        }

        Bindings bindings = new Bindings().addAddress(InetAddress.getLocalHost());
//        Bindings bindings = new Bindings().addInterface("lo0");
        Peer[] peers = new Peer[nrOfPeers];
        if (automaticFuture != null) {
          Number160 peerId = new Number160(rnd);
          PeerMap peerMap = new PeerMap(new PeerMapConfiguration(peerId));
View Full Code Here

    public static PeerDHT[] createNodes(int nrOfPeers, Random rnd, int port, AutomaticFuture automaticFuture,
            boolean replication, boolean maintenance, boolean rsync) throws Exception {
        if (nrOfPeers < 1) {
            throw new IllegalArgumentException("Cannot create less than 1 peer");
        }
        Bindings bindings = new Bindings().addInterface("lo");
        PeerDHT[] peers = new PeerDHT[nrOfPeers];
       
        PeerBuilder pm = new PeerBuilder(new Number160(rnd))
                   .ports(port).enableMaintenance(maintenance)
                   .bindings(bindings);
View Full Code Here

     */
    @Test
    @Ignore
    public void startServer() throws IOException {
        Random r = new Random(Utils2.THE_ANSWER);
        Bindings b = new Bindings().addProtocol(StandardProtocolFamily.INET6);
        Peer peer = new PeerBuilder(new Number160(r)).bindings(b).ports(port).start();
        for (int i = 0; i < Integer.MAX_VALUE; i++) {
            for (PeerAddress pa : peer.peerBean().peerMap().all()) {
               
                FutureChannelCreator fcc = peer.connectionBean().reservation().create(1, 1);
View Full Code Here

     */
    @Test
    @Ignore
    public void startClient() throws IOException {
        Random r = new Random(Utils2.THE_ANSWER2);
        Bindings b = new Bindings().addProtocol(StandardProtocolFamily.INET6);
        Peer peer = new PeerBuilder(new Number160(r)).bindings(b).ports(port).start();
        FutureBootstrap fb = peer.bootstrap().inetAddress(InetAddress.getByName(ipSuperPeer)).ports(port).start();
        fb.awaitUninterruptibly();
        System.out.println("Got it: " + fb.isSuccess());
    }
View Full Code Here

    }
  }

  public static void startServer() throws Exception {
    Random rnd = new Random(43L);
    Bindings b = new Bindings().addProtocol(StandardProtocolFamily.INET).addAddress(
            InetAddress.getByName("127.0.0.1"));
    // b.addInterface("eth0");
    Peer master = new PeerBuilder(new Number160(rnd)).ports(4000).bindings(b).start();
    System.out.println("Server started Listening to: " + DiscoverNetworks.discoverInterfaces(b));
    System.out.println("address visible to outside is " + master.peerAddress());
View Full Code Here

    }
  }

  public static void startClient(String ipAddress) throws Exception {
    Random rnd = new Random();
    Bindings b = new Bindings().addProtocol(StandardProtocolFamily.INET).addAddress(
            InetAddress.getByName("127.0.0.1"));
    // b.addInterface("eth0");
    Peer client = new PeerBuilder(new Number160(rnd)).ports(4001).bindings(b).start();
    System.out.println("Client started and Listening to: " + DiscoverNetworks.discoverInterfaces(b));
    System.out.println("address visible to outside is " + client.peerAddress());
View Full Code Here

    public static PeerDHT[] createNodes(int nrOfPeers, Random rnd, int port, AutomaticFuture automaticFuture,
            boolean maintenance) throws Exception {
        if (nrOfPeers < 1) {
            throw new IllegalArgumentException("Cannot create less than 1 peer");
        }
        Bindings bindings = new Bindings().addInterface("lo");
        PeerDHT[] peers = new PeerDHT[nrOfPeers];
        final Peer master;
        if (automaticFuture != null) {
          Number160 peerId = new Number160(rnd);
          PeerMap peerMap = new PeerMap(new PeerMapConfiguration(peerId));
View Full Code Here

 
  public static PeerDHT[] createNodes(int nrOfPeers, Random rnd, int port, AutomaticFuture automaticFuture) throws Exception {
        if (nrOfPeers < 1) {
            throw new IllegalArgumentException("Cannot create less than 1 peer");
        }
        Bindings bindings = new Bindings().addInterface("lo");
        PeerDHT[] peers  = new PeerDHT[nrOfPeers];
        final Peer master;
        if (automaticFuture != null) {
          Number160 peerId = new Number160(rnd);
          PeerMap peerMap = new PeerMap(new PeerMapConfiguration(peerId));
View Full Code Here

  @Test
  public void testDirectMessage1() throws Exception {
    Peer sender = null;
    Peer recv1 = null;
    try {
      Bindings b = new Bindings();
      sender = new PeerBuilder(new Number160("0x50")).bindings(b).ports(2424).start();
      recv1 = new PeerBuilder(new Number160("0x20")).bindings(b).ports(8088).start();
      recv1.objectDataReply(new ObjectDataReply() {
        @Override
        public Object reply(PeerAddress sender, Object request) throws Exception {
View Full Code Here

TOP

Related Classes of net.tomp2p.connection.Bindings

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.