Package org.apache.qpid.transport

Examples of org.apache.qpid.transport.ConnectionSettings


    public void testSslVerifyHostNameTurnedOffViaSystemProperty() throws Exception
    {
        setTestSystemProperty(ClientProperties.CONNECTION_OPTION_SSL_VERIFY_HOST_NAME, "false");
        String brokerURL = "tcp://localhost:5672?ssl='true'";
        AMQBrokerDetails broker = new AMQBrokerDetails(brokerURL);
        ConnectionSettings connectionSettings = broker.buildConnectionSettings();
        assertFalse(String.format("Unexpected '%s' option value", BrokerDetails.OPTIONS_SSL_VERIFY_HOSTNAME),
                connectionSettings.isVerifyHostname());
        assertNull(String.format("Unexpected '%s' property value", BrokerDetails.OPTIONS_SSL_VERIFY_HOSTNAME),
                broker.getProperty(BrokerDetails.OPTIONS_SSL_VERIFY_HOSTNAME));
    }
View Full Code Here


            _logger.debug("Connecting to broker:" + brokerDetail);
        }
        final Set<AMQState> openOrClosedStates =
                EnumSet.of(AMQState.CONNECTION_OPEN, AMQState.CONNECTION_CLOSED);

        ConnectionSettings settings = brokerDetail.buildConnectionSettings();
        settings.setProtocol(brokerDetail.getTransport());

        //Check connection-level ssl override setting
        String connectionSslOption = _conn.getConnectionURL().getOption(ConnectionURL.OPTIONS_SSL);
        if(connectionSslOption != null)
        {
            boolean connUseSsl = Boolean.parseBoolean(connectionSslOption);
            boolean brokerlistUseSsl = settings.isUseSSL();

            if( connUseSsl != brokerlistUseSsl)
            {
                settings.setUseSSL(connUseSsl);

                if (_logger.isDebugEnabled())
                {
                    _logger.debug("Applied connection ssl option override, setting UseSsl to: " + connUseSsl );
                }
View Full Code Here

                        + _conn.getVirtualHost() + " username: "
                        + _conn.getUsername() + " password: "
                        + _conn.getPassword());
            }

            ConnectionSettings conSettings = new ConnectionSettings();
            retriveConnectionSettings(conSettings,brokerDetail);
            _qpidConnection.connect(conSettings);

            _conn._connected = true;
            _conn.setUsername(_qpidConnection.getUserID());
View Full Code Here

                EnumSet.of(AMQState.CONNECTION_OPEN, AMQState.CONNECTION_CLOSED);


        StateWaiter waiter = _conn.getProtocolHandler().createWaiter(openOrClosedStates);

        ConnectionSettings settings = brokerDetail.buildConnectionSettings();
        settings.setProtocol(brokerDetail.getTransport());

        SSLContext sslContext = null;
        if (settings.isUseSSL())
        {
            try
            {
                sslContext = SSLContextFactory.buildClientContext(
                                settings.getTrustStorePath(),
                                settings.getTrustStorePassword(),
                                settings.getTrustManagerFactoryAlgorithm(),
                                settings.getKeyStorePath(),
                                settings.getKeyStorePassword(),
                                settings.getKeyManagerFactoryAlgorithm(),
                                settings.getCertAlias());
            }
            catch (GeneralSecurityException e)
            {
                throw new AMQException("Unable to create SSLContext: " + e.getMessage(), e);
            }
View Full Code Here

                        + _conn.getVirtualHost() + " username: "
                        + _conn.getUsername() + " password: "
                        + "********");
            }

            ConnectionSettings conSettings = retriveConnectionSettings(brokerDetail);
            _qpidConnection.setConnectionDelegate(new ClientConnectionDelegate(conSettings, _conn.getConnectionURL()));
            _qpidConnection.connect(conSettings);

            _conn.setConnected(true);
            _conn.setUsername(_qpidConnection.getUserID());
View Full Code Here

        return featureSupported;
    }

    private ConnectionSettings retriveConnectionSettings(BrokerDetails brokerDetail)
    {
        ConnectionSettings conSettings = brokerDetail.buildConnectionSettings();

        conSettings.setVhost(_conn.getVirtualHost());
        conSettings.setUsername(_conn.getUsername());
        conSettings.setPassword(_conn.getPassword());

        // Pass client name from connection URL
        Map<String, Object> clientProps = new HashMap<String, Object>();
        try
        {
            clientProps.put(ConnectionStartProperties.CLIENT_ID_0_10, _conn.getClientID());
          conSettings.setClientProperties(clientProps);
        }
        catch (JMSException e)
        {
            // Ignore
        }

        conSettings.setHeartbeatInterval(getHeartbeatInterval(brokerDetail));

        return conSettings;
    }
View Full Code Here

    {
        if(updateState(State.DOWN, State.ESTABLISHING))
        {
            try
            {
                _qpidConnection.setConnectionDelegate(new ClientDelegate(new ConnectionSettings())
                {
                    protected SaslClient createSaslClient(List<Object> brokerMechs) throws ConnectionException,
                                                                                           SaslException
                    {
                        Map<String,Object> saslProps = new HashMap<String,Object>();
View Full Code Here

            _logger.debug("Connecting to broker:" + brokerDetail);
        }
        final Set<AMQState> openOrClosedStates =
                EnumSet.of(AMQState.CONNECTION_OPEN, AMQState.CONNECTION_CLOSED);

        ConnectionSettings settings = brokerDetail.buildConnectionSettings();
        settings.setProtocol(brokerDetail.getTransport());

        //Check connection-level ssl override setting
        String connectionSslOption = _conn.getConnectionURL().getOption(ConnectionURL.OPTIONS_SSL);
        if(connectionSslOption != null)
        {
            boolean connUseSsl = Boolean.parseBoolean(connectionSslOption);
            boolean brokerlistUseSsl = settings.isUseSSL();

            if( connUseSsl != brokerlistUseSsl)
            {
                settings.setUseSSL(connUseSsl);

                if (_logger.isDebugEnabled())
                {
                    _logger.debug("Applied connection ssl option override, setting UseSsl to: " + connUseSsl );
                }
View Full Code Here

TOP

Related Classes of org.apache.qpid.transport.ConnectionSettings

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.