Package net.tomp2p.futures

Examples of net.tomp2p.futures.FutureDirect.awaitUninterruptibly()


                });

                FuturePeerConnection futurePeerConnection = peer1DHT.peer().createPeerConnection(peer2DHT.peer()
                                                                                                         .peerAddress(), 500);
                FutureDirect futureDirect = peer1DHT.peer().sendDirect(futurePeerConnection).object("hallo").start();
                futureDirect.awaitUninterruptibly();


                countDownLatch.await(3, TimeUnit.SECONDS);
                if (countDownLatch.getCount() > 0)
                    Assert.fail("The test method did not complete successfully!");
View Full Code Here


                                                               seedPort);

            FuturePeerConnection futurePeerConnection = peer1DHT.peer().createPeerConnection
                    (reachablePeerAddress, 500);
            FutureDirect futureDirect = peer1DHT.peer().sendDirect(futurePeerConnection).object("hallo").start();
            futureDirect.awaitUninterruptibly();
            assertTrue(futureDirect.isSuccess());
            assertEquals("pong", futureDirect.object());

            shutdown();
        }
View Full Code Here

            });
           
            String sentObject = "Hello";
            FutureDirect fd = peer1.sendDirect(peer2.peerAddress()).object(sentObject).start();
            System.out.println("send " + sentObject);
            fd.awaitUninterruptibly();
           
            System.out.println("received " + fd.object() + " connections: "
                    + ccohTCP.total()+ "/"+ccohUDP.total());
           
            // keep the connection for 20s alive. Setting -1 means to keep it open as long as possible
View Full Code Here

            // keep the connection for 20s alive. Setting -1 means to keep it open as long as possible
            FuturePeerConnection futurePeerConnection = peer1.createPeerConnection(peer2.peerAddress(), timeout);
           
            fd = peer1.sendDirect(futurePeerConnection).object(sentObject).start();
            System.out.println("send " + sentObject);
            fd.awaitUninterruptibly();
            System.out.println("received " + fd.object() + " connections: "
                    + ccohTCP.total()+ "/"+ccohUDP.total());
            // we reuse the connection
            fd = peer1.sendDirect(futurePeerConnection).object(sentObject).start();
            System.out.println("send " + sentObject);
View Full Code Here

            System.out.println("received " + fd.object() + " connections: "
                    + ccohTCP.total()+ "/"+ccohUDP.total());
            // we reuse the connection
            fd = peer1.sendDirect(futurePeerConnection).object(sentObject).start();
            System.out.println("send " + sentObject);
            fd.awaitUninterruptibly();
            System.out.println("received " + fd.object() + " connections: "
                    + ccohTCP.total()+ "/"+ccohUDP.total());
            // now we don't want to keep the connection open anymore:
            futurePeerConnection.close();
        } finally {
View Full Code Here

        return null;
      }
    });

    FutureDirect fd = reachable.sendDirect(unreachable.peerAddress()).object(requestString).start();
    fd.awaitUninterruptibly();

    checkFail(cLatch);

    System.err.println("testReverseConnection() end!");
  }
View Full Code Here

            // fpc.awaitUninterruptibly();
            // PeerConnection peerConnection = fpc.peerConnection();
            String sentObject = "Hello";
            FutureDirect fd = peer1.sendDirect(fpc).object(sentObject).start();
            System.out.println("send " + sentObject);
            fd.awaitUninterruptibly();
            Assert.assertEquals(true, fd.isSuccess());
            System.out.println("received " + fd.object() + " connections: "
                    + ccohTCP.total());
            // we reuse the connection
            long start = System.currentTimeMillis();
View Full Code Here

                    + ccohTCP.total());
            // we reuse the connection
            long start = System.currentTimeMillis();
            System.out.println("send " + sentObject);
            fd = peer1.sendDirect(fpc).object(sentObject).start();
            fd.awaitUninterruptibly();
            System.err.println(fd.failedReason());
            Assert.assertEquals(true, fd.isSuccess());
            System.err.println(fd.failedReason());
            System.out.println("received " + fd.object() + " connections: "
                    + ccohTCP.total());
View Full Code Here

            Assert.assertEquals(1, ccohTCP.total());
            Assert.assertEquals(0, ccohUDP.total());
            Thread.sleep(2000);
            System.err.println("send second with the same connection");
            FutureDirect fd2 = sender.sendDirect(peerConnection).object("test").start();
            fd2.awaitUninterruptibly();
            Assert.assertEquals(1, ccohTCP.total());
            Assert.assertEquals(0, ccohUDP.total());
            Assert.assertEquals(true, fd2.isSuccess());
            peerConnection.close().await();
            System.err.println("done");
View Full Code Here

            ccohTCP.reset();
            ccohUDP.reset();

            FutureDirect fd1 = sender.sendDirect(peerConnection).object("test")
                    .connectionTimeoutTCPMillis(2000).idleTCPSeconds(5).start();
            fd1.awaitUninterruptibly();

            Assert.assertEquals(1, ccohTCP.total());

            Thread.sleep(7000);
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.