Examples of PeerConnection


Examples of net.tomp2p.connection.PeerConnection

      fpc.addListener(new BaseFutureAdapter<FuturePeerConnection>() {
        @Override
        public void operationComplete(final FuturePeerConnection future) throws Exception {
          if (future.isSuccess() && future.peerConnection() != null) {
            // successfully created a connection from unreachable to the requester
            final PeerConnection peerConnection = future.peerConnection();
           
            final Message readyMessage = createReadyForRequestMessage(message, peerConnection.remotePeer());
            FutureResponse futureResponse = RelayUtils.send(peerConnection, peer.peerBean(),
                peer.connectionBean(), config, readyMessage);
            futureResponse.addListener(new BaseFutureAdapter<FutureResponse>() {
              @Override
              public void operationComplete(final FutureResponse future) throws Exception {
View Full Code Here

Examples of net.tomp2p.connection.PeerConnection

    final FuturePeerConnection fpc = peer.createPeerConnection(candidate);
    fpc.addListener(new BaseFutureAdapter<FuturePeerConnection>() {
      public void operationComplete(final FuturePeerConnection futurePeerConnection) throws Exception {
        if (futurePeerConnection.isSuccess()) {
          // successfully created a connection to the relay peer
          final PeerConnection peerConnection = futurePeerConnection.object();

          // send the message
          FutureResponse response = RelayUtils.send(peerConnection, peer.peerBean(), peer.connectionBean(),
              config, message);
          response.addListener(new BaseFutureAdapter<FutureResponse>() {
View Full Code Here

Examples of net.tomp2p.connection.PeerConnection

    final FuturePeerConnection fpc = peer.createPeerConnection(message.recipient());
    fpc.addListener(new BaseFutureAdapter<FuturePeerConnection>() {
            public void operationComplete(final FuturePeerConnection futurePeerConnection) throws Exception {
                if (futurePeerConnection.isSuccess()) {
                  // successfully created a connection to the other peer
                  final PeerConnection peerConnection = futurePeerConnection.object();
                 
                  // send the message
                  send(peerConnection, peer.peerBean(), peer.connectionBean(), config, futureResponse);
                } else {
                    futureResponse.failed(fpc);
View Full Code Here

Examples of net.tomp2p.connection.PeerConnection

    fpc.addListener(new BaseFutureAdapter<FuturePeerConnection>() {
      // wait for the connection to the relay Peer
      @Override
      public void operationComplete(FuturePeerConnection future) throws Exception {
        if (fpc.isSuccess()) {
          final PeerConnection peerConnection = fpc.peerConnection();
          if (peerConnection != null) {
            // create the necessary messages
            final Message setUpMessage = createSetupMessage(relayPeerAddress, unreachablePeerAddress);

            // send the message to the relay so it forwards it to the unreachable peer
            FutureResponse futureResponse = RelayUtils.send(peerConnection, peer.peerBean(),
                peer.connectionBean(), config, setUpMessage);

            // wait for the unreachable peer to answer
            futureResponse.addListener(new BaseFutureAdapter<FutureResponse>() {
              @Override
              public void operationComplete(FutureResponse future) throws Exception {
                // get the PeerConnection which is cached in the PeerBean object
                final PeerConnection openPeerConnection = peer.peerBean().peerConnection(unreachablePeerAddress.peerId());
                if (openPeerConnection != null && openPeerConnection.isOpen()) {
                  futureDone.done(openPeerConnection);
                } else {
                  LOG.error("The reverse connection to the unreachable peer failed.");
                  handleFail(futureDone, "No reverse connection could be established");
                }
View Full Code Here

Examples of net.tomp2p.connection.PeerConnection

        fcc.addListener(new BaseFutureAdapter<FutureChannelCreator>() {
            @Override
            public void operationComplete(final FutureChannelCreator future) throws Exception {
                if (future.isSuccess()) {
                    final ChannelCreator cc = fcc.channelCreator();
                    final PeerConnection peerConnection = new PeerConnection(destination, cc, heartBeatMillis);
                    futureDone.done(peerConnection);
                } else {
                    futureDone.failed(future);
                }
            }
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.