Package org.apache.qpid.amqp_1_0.jms.impl

Examples of org.apache.qpid.amqp_1_0.jms.impl.ConnectionFactoryImpl


            if (_saslServer.isComplete())
            {
                SaslOutcome outcome = new SaslOutcome();

                outcome.setCode(SaslCode.OK);
                _saslFrameOutput.send(new SASLFrame(outcome), null);
                synchronized (getLock())
                {
                    _saslComplete = true;
                    _authenticated = true;
                    _user = _saslServerProvider.getAuthenticatedPrincipal(_saslServer);
                    getLock().notifyAll();
                }

                if (_onSaslCompleteTask != null)
                {
                    _onSaslCompleteTask.run();
                }

            }
            else
            {
                SaslChallenge challengeBody = new SaslChallenge();
                challengeBody.setChallenge(new Binary(challenge));
                _saslFrameOutput.send(new SASLFrame(challengeBody), null);

            }
        }
        catch (SaslException e)
        {
            SaslOutcome outcome = new SaslOutcome();

            outcome.setCode(SaslCode.AUTH);
            _saslFrameOutput.send(new SASLFrame(outcome), null);
            synchronized (getLock())
            {
                _saslComplete = true;
                _authenticated = false;
                getLock().notifyAll();
View Full Code Here


        }
        else if (mechanisms.contains(SASL_EXTERNAL))
        {
            init.setMechanism(SASL_EXTERNAL);
        }
        _saslFrameOutput.send(new SASLFrame(init), null);
    }
View Full Code Here

            if (_saslServer.isComplete())
            {
                SaslOutcome outcome = new SaslOutcome();

                outcome.setCode(SaslCode.OK);
                _saslFrameOutput.send(new SASLFrame(outcome), null);
                synchronized (getLock())
                {
                    _saslComplete = true;
                    _authenticated = true;
                    _user = _saslServerProvider.getAuthenticatedPrincipal(_saslServer);
                    getLock().notifyAll();
                }
                if (_onSaslCompleteTask != null)
                {
                    _onSaslCompleteTask.run();
                }

            }
            else
            {
                SaslChallenge challengeBody = new SaslChallenge();
                challengeBody.setChallenge(new Binary(challenge));
                _saslFrameOutput.send(new SASLFrame(challengeBody), null);

            }
        }
        catch (SaslException e)
        {
            SaslOutcome outcome = new SaslOutcome();

            outcome.setCode(SaslCode.AUTH);
            _saslFrameOutput.send(new SASLFrame(outcome), null);
            synchronized (getLock())
            {
                _saslComplete = true;
                _authenticated = false;
                getLock().notifyAll();
View Full Code Here

        for (String name : mechanismNames)
        {
            mechanismsList.add(Symbol.valueOf(name));
        }
        mechanisms.setSaslServerMechanisms(mechanismsList.toArray(new Symbol[mechanismsList.size()]));
        _saslFrameOutput.send(new SASLFrame(mechanisms), null);
    }
View Full Code Here

        }
    }

    public void createConnectionFactory(String name) {
        try {
            final ConnectionFactory factory = new ConnectionFactoryImpl("localhost", port, null, null);
            context.bind(name, factory);
        } catch (NamingException e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

        }
    }

    public void createConnectionFactory(String name) {
        try {
            final ConnectionFactory factory = new ConnectionFactoryImpl("localhost", port, null, null);
            context.bind(name, factory);
        } catch (NamingException e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

        mqtt.setHost("localhost", mqttConnector.getConnectUri().getPort());
        return mqtt;
    }

    public Connection createAmqpConnection() throws Exception {
        final ConnectionFactoryImpl factory = new ConnectionFactoryImpl("localhost", amqpConnector.getConnectUri().getPort(), "admin", "password");
        final Connection connection = factory.createConnection();
        connection.setExceptionListener(new ExceptionListener() {
            @Override
            public void onException(JMSException exception) {
                exception.printStackTrace();
            }
View Full Code Here

    private Connection createConnection(String clientId, boolean syncPublish) throws JMSException {

        int brokerPort = getBrokerPort();
        LOG.debug("Creating connection on port {}", brokerPort);
        final ConnectionFactoryImpl factory = new ConnectionFactoryImpl("localhost", brokerPort, "admin", "password");

        factory.setSyncPublish(syncPublish);
        factory.setTopicPrefix("topic://");
        factory.setQueuePrefix("queue://");

        final Connection connection = factory.createConnection();
        if (clientId != null && !clientId.isEmpty()) {
            connection.setClientID(clientId);
        }
        connection.setExceptionListener(new ExceptionListener() {
            @Override
View Full Code Here

    }

    @Test(timeout = 10000)
    public void testNoUserOrPassword() throws Exception {
        try {
            ConnectionFactoryImpl factory = new ConnectionFactoryImpl("localhost", port, "", "");
            Connection connection = factory.createConnection();
            connection.setExceptionListener(new ExceptionListener() {
                @Override
                public void onException(JMSException exception) {
                    LOG.error("Unexpected exception ", exception);
                    exception.printStackTrace();
View Full Code Here

    }

    @Test(timeout = 10000)
    public void testUnknownUser() throws Exception {
        try {
            ConnectionFactoryImpl factory = new ConnectionFactoryImpl("localhost", port, "admin", "password");
            Connection connection = factory.createConnection("nosuchuser", "blah");
            connection.start();
            Thread.sleep(500);
            connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
            fail("Expected JMSException");
        } catch (JMSException e)  {
View Full Code Here

TOP

Related Classes of org.apache.qpid.amqp_1_0.jms.impl.ConnectionFactoryImpl

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.