Examples of NetworkConnection


Examples of com.aelitis.azureus.core.networkmanager.NetworkConnection

    final HTTPNetworkConnection    old_http_connection,
    final byte[]          old_hash,
    final byte[]          new_hash,
    final String          header )
  {
    final NetworkConnection  old_connection = old_http_connection.getConnection();
   
    PeerManagerRegistration reg_data =
      PeerManager.getSingleton().manualMatchHash(
          old_connection.getEndpoint().getNotionalAddress(),
          new_hash );

    if ( reg_data == null ){
     
      old_http_connection.close( "Re-routing failed - registration not found" );
     
      return;
    }
 
    final Transport transport = old_connection.detachTransport();
   
    old_http_connection.close( "Switching torrents" );
   
    final NetworkConnection new_connection =
      NetworkManager.getSingleton().bindTransport(
          transport,
          new HTTPMessageEncoder(),
          new HTTPMessageDecoder( header ));
   
View Full Code Here

Examples of com.aelitis.azureus.core.networkmanager.NetworkConnection

   
    ConnectionEndpoint connection_endpoint  = new ConnectionEndpoint( address );

    connection_endpoint.addProtocol( pe );

    final NetworkConnection connection =
      NetworkManager.getSingleton().createConnection(
          connection_endpoint,
          new BTMessageEncoder(),
          new BTMessageDecoder(),
          use_crypto,
View Full Code Here

Examples of org.apache.qpid.transport.network.NetworkConnection

        SecurityLayer securityLayer = SecurityLayerFactory.newInstance(settings);

        OutgoingNetworkTransport transport = Transport.getOutgoingTransportInstance(getProtocolVersion());

        NetworkConnection network = transport.connect(settings, securityLayer.receiver(_conn.getProtocolHandler()),
                                                      _conn.getProtocolHandler());

        _conn.getProtocolHandler().setNetworkConnection(network, securityLayer.sender(network.getSender()));

        StateWaiter waiter = _conn.getProtocolHandler().createWaiter(openOrClosedStates);
        _conn.getProtocolHandler().getProtocolSession().init(settings);
        // this blocks until the connection has been set up or when an error
        // has prevented the connection being set up

        AMQState state = waiter.await();

        if(state == AMQState.CONNECTION_OPEN)
        {
            _conn.getFailoverPolicy().attainedConnection();
            _conn.setConnected(true);
            _conn.logConnected(network.getLocalAddress(), network.getRemoteAddress());
            return null;
        }
        else
        {
            return _conn.getProtocolHandler().getSuggestedProtocolVersion();
View Full Code Here

Examples of org.apache.qpid.transport.network.NetworkConnection

            //Due to the error we must forcefully close the connection without negotiation
            sconn.getSender().close();
            return;
        }

        final NetworkConnection networkConnection = sconn.getNetworkConnection();
        if(ok.hasHeartbeat())
        {
            int heartbeat = ok.getHeartbeat();
            if(heartbeat < 0)
            {
                heartbeat = 0;
            }

            networkConnection.setMaxReadIdle(2 * heartbeat);
            networkConnection.setMaxWriteIdle(heartbeat);

        }
        else
        {
            networkConnection.setMaxReadIdle(0);
            networkConnection.setMaxWriteIdle(0);
        }

        setConnectionTuneOkChannelMax(sconn, okChannelMax);
    }
View Full Code Here

Examples of org.apache.qpid.transport.network.NetworkConnection

    private AMQConnection _connection;

    public void setUp() throws Exception
    {
        _connection = new MockAMQConnection("amqp://guest:guest@/test?brokerlist='tcp://localhost:5672'");
        NetworkConnection network = new TestNetworkConnection();
        _connection.getProtocolHandler().setNetworkConnection(network);
    }
View Full Code Here

Examples of org.apache.qpid.transport.network.NetworkConnection

        if(ok.hasHeartbeat())
        {
            final int heartbeat = ok.getHeartbeat();
            if(heartbeat > 0)
            {
                final NetworkConnection networkConnection = sconn.getNetworkConnection();
                networkConnection.setMaxReadIdle(2 * heartbeat);
                networkConnection.setMaxWriteIdle(heartbeat);
            }
        }

        setConnectionTuneOkChannelMax(sconn, okChannelMax);
    }
View Full Code Here

Examples of org.apache.qpid.transport.network.NetworkConnection

                        socket.setReceiveBufferSize(receiveBufferSize);


                        ProtocolEngine engine = _factory.newProtocolEngine();

                        NetworkConnection connection = new IoNetworkConnection(socket, engine, sendBufferSize, receiveBufferSize, TIMEOUT);

                        if(_sslContext != null)
                        {
                            try
                            {
                                Principal peerPrincipal = ((SSLSocket) socket).getSession().getPeerPrincipal();
                                connection.setPeerPrincipal(peerPrincipal);
                            }
                            catch(SSLPeerUnverifiedException e)
                            {
                                // ignore
                            }
                        }

                        engine.setNetworkConnection(connection, connection.getSender());

                        connection.start();
                    }
                    catch(RuntimeException e)
                    {
                        LOGGER.error("Error in Acceptor thread on port " + _config.getPort(), e);
                        closeSocketIfNecessary(socket);
View Full Code Here

Examples of org.apache.qpid.transport.network.NetworkConnection

        }

        SecurityLayer securityLayer = SecurityLayerFactory.newInstance(settings);

        OutgoingNetworkTransport transport = Transport.getOutgoingTransportInstance(getProtocolVersion());
        NetworkConnection network = transport.connect(settings, securityLayer.receiver(_conn.getProtocolHandler()), sslContext);
        _conn.getProtocolHandler().setNetworkConnection(network, securityLayer.sender(network.getSender()));
        _conn.getProtocolHandler().getProtocolSession().init();
        // this blocks until the connection has been set up or when an error
        // has prevented the connection being set up

        AMQState state = waiter.await();

        if(state == AMQState.CONNECTION_OPEN)
        {
            _conn.getFailoverPolicy().attainedConnection();
            _conn.setConnected(true);
            _conn.logConnected(network.getLocalAddress(), network.getRemoteAddress());
            return null;
        }
        else
        {
            return _conn.getProtocolHandler().getSuggestedProtocolVersion();
View Full Code Here

Examples of org.apache.qpid.transport.network.NetworkConnection

            if(secureReceiver instanceof ConnectionListener)
            {
                addConnectionListener((ConnectionListener)secureReceiver);
            }

            NetworkConnection network = transport.connect(settings, secureReceiver, null);
            _remoteAddress = network.getRemoteAddress();
            _localAddress = network.getLocalAddress();

            final Sender<ByteBuffer> secureSender = securityLayer.sender(network.getSender());
            if(secureSender instanceof ConnectionListener)
            {
                addConnectionListener((ConnectionListener)secureSender);
            }
            sender = new Disassembler(secureSender, settings.getMaxFrameSize());
View Full Code Here

Examples of org.apache.qpid.transport.network.NetworkConnection

            //Due to the error we must forcefully close the connection without negotiation
            sconn.getSender().close();
            return;
        }

        final NetworkConnection networkConnection = sconn.getNetworkConnection();

        if(ok.hasHeartbeat())
        {
            int heartbeat = ok.getHeartbeat();
            if(heartbeat < 0)
            {
                heartbeat = 0;
            }

            networkConnection.setMaxReadIdle(2 * heartbeat);
            networkConnection.setMaxWriteIdle(heartbeat);

        }
        else
        {
            networkConnection.setMaxReadIdle(0);
            networkConnection.setMaxWriteIdle(0);
        }

        setConnectionTuneOkChannelMax(sconn, okChannelMax);
    }
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.