Examples of NetworkConnection


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

                        socket.setSendBufferSize(sendBufferSize);
                        socket.setReceiveBufferSize(receiveBufferSize);

                        ProtocolEngine engine = _factory.newProtocolEngine();

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

                        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

    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

                            socket.setSendBufferSize(sendBufferSize);
                            socket.setReceiveBufferSize(receiveBufferSize);


                            final IdleTimeoutTicker ticker = new IdleTimeoutTicker(engine, TIMEOUT);
                            NetworkConnection connection =
                                    new IoNetworkConnection(socket, engine, sendBufferSize, receiveBufferSize, _timeout,
                                                            ticker);

                            connection.setMaxReadIdle(HANSHAKE_TIMEOUT);

                            ticker.setConnection(connection);

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

                            connection.start();
                        }
                        else
                        {
                            socket.close();
                        }
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());

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

            StateWaiter waiter = _conn.getProtocolHandler().createWaiter(openOrClosedStates);
            _conn.getProtocolHandler().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());
                _messageCompressionSupported = checkMessageCompressionSupported();
                _confirmedPublishSupported = checkConfirmedPublishSupported();
                _confirmedPublishNonTransactionalSupported = checkConfirmedPublishNonTransactionalSupported();
                return null;
            }
            else
            {
                return _conn.getProtocolHandler().getSuggestedProtocolVersion();
            }
        }
        catch(AMQException | RuntimeException e)
        {
            network.close();
            throw e;
        }

    }
View Full Code Here

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

        else if(okMaxFrameSize == 0)
        {
            okMaxFrameSize = getFrameMax();
        }

        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);

        conn.setMaxFrameSize(okMaxFrameSize);
View Full Code Here

Examples of org.jclouds.vcloud.director.v1_5.domain.network.NetworkConnection

      // vapp contains a network configuration. we should add the vm to this
      // vapp network
      else {
         if (vAppHasNetworkConfigured(vApp)) {
            VAppNetworkConfiguration vAppNetworkConfiguration = getVAppNetworkConfig(vApp);
            NetworkConnection networkConnection = NetworkConnection.builder()
                     .network(vAppNetworkConfiguration.getNetworkName())
                     .ipAddressAllocationMode(IpAddressAllocationMode.DHCP).build();

            NetworkConnectionSection networkConnectionSection = NetworkConnectionSection.builder().info("networkInfo")
                     .primaryNetworkConnectionIndex(0).networkConnection(networkConnection).build();
View Full Code Here

Examples of org.jclouds.vcloud.director.v1_5.domain.network.NetworkConnection

  
   private void cleanUpNetworkConnectionSection(Vm toAddVm) {
      NetworkConnectionSection networkConnectionSection = vmApi.getNetworkConnectionSection(toAddVm.getId());
      Set<NetworkConnection> networkConnections = networkConnectionSection.getNetworkConnections();
      for (NetworkConnection networkConnection : networkConnections) {
         NetworkConnection newNetworkConnection = networkConnection.toBuilder().isConnected(false).build();
         networkConnectionSection = networkConnectionSection.toBuilder().networkConnection(newNetworkConnection)
                  .build();
      }

      Task configureNetwork = vmApi.editNetworkConnectionSection(toAddVm.getId(), networkConnectionSection);
View Full Code Here

Examples of org.jclouds.vcloud.director.v1_5.domain.network.NetworkConnection

               .info("info")
               .primaryNetworkConnectionIndex(0)
               .build();
     
      for (NetworkConnection networkConnection : networkConnections) {
         NetworkConnection newNetworkConnection = networkConnection.toBuilder()
                  .network(vAppNetworkName)
                  .isConnected(true)
                  .networkConnectionIndex(0)
                  .ipAddressAllocationMode(IpAddressAllocationMode.POOL)
                  .build();
View Full Code Here

Examples of org.jclouds.vcloud.director.v1_5.domain.network.NetworkConnection

    Reference network = Iterables.getLast(networks);

    // Copy existing section and edit fields
    NetworkConnectionSection oldSection = vmApi
        .getNetworkConnectionSection(vmUrn);
    NetworkConnection newNetworkConnection = NetworkConnection.builder()
        .network(network.getName()).networkConnectionIndex(1)
        .ipAddressAllocationMode(IpAddressAllocationMode.DHCP).build();
    NetworkConnectionSection newSection = oldSection.toBuilder()
        .networkConnection(newNetworkConnection).build();

    // The method under test
    Task editNetworkConnectionSection = vmApi.editNetworkConnectionSection(
        vmUrn, newSection);
    assertTrue(retryTaskSuccess.apply(editNetworkConnectionSection),
        String.format(TASK_COMPLETE_TIMELY,
            "editNetworkConnectionSection"));

    // Retrieve the modified section
    NetworkConnectionSection modified = vmApi
        .getNetworkConnectionSection(vmUrn);

    // Check the retrieved object is well formed
    checkNetworkConnectionSection(modified);

    // Check the section was modified correctly
    for (NetworkConnection connection : modified.getNetworkConnections()) {
      if (connection.getNetwork().equals(
          newNetworkConnection.getNetwork())) {
        assertEquals(connection.getIpAddressAllocationMode(),
            newNetworkConnection.getIpAddressAllocationMode());
        assertSame(connection.getNetworkConnectionIndex(), newNetworkConnection
            .getNetworkConnectionIndex());
      }
    }
  }
View Full Code Here

Examples of org.jclouds.vcloud.director.v1_5.domain.network.NetworkConnection

               .info("info")
               .primaryNetworkConnectionIndex(0)
               .build();
     
      for (NetworkConnection networkConnection : networkConnections) {
         NetworkConnection newNetworkConnection = networkConnection.toBuilder()
                  .network(vAppNetworkName)
                  .isConnected(true)
                  .networkConnectionIndex(0)
                  .ipAddressAllocationMode(IpAddressAllocationMode.POOL)
                  .build();
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.