Package org.apache.qpid.client

Examples of org.apache.qpid.client.AMQConnection


        }
    }

    public void testClientIdIsPopulatedAutomatically() throws Exception
    {
        Connection connection = new AMQConnection(getBroker().toString(), "guest", "guest",
                                                  null, "test");
        try
        {
            assertNotNull(connection.getClientID());
        }
        finally
        {
            connection.close();
        }
        connection.close();
    }
View Full Code Here


        BrokerDetails broker = getBroker();
        broker.setProperty(BrokerDetails.OPTIONS_SASL_MECHS, "MY_MECH");

        try
        {
            Connection connection = new AMQConnection(broker.toString(), "guest", "guest",
                    null, "test");
            connection.close();
            fail("The client should throw a ConnectionException stating the" +
                " broker does not support the SASL mech specified by the client");
        }
        catch (Exception e)
        {
View Full Code Here

        setTestSystemProperty(ClientProperties.QPID_VERIFY_CLIENT_ID, "true");

        BrokerDetails broker = getBroker();
        try
        {
            Connection con = new AMQConnection(broker.toString(), "guest", "guest",
                                        "client_id", "test");

            Connection con2 = new AMQConnection(broker.toString(), "guest", "guest",
                                        "client_id", "test");

            fail("The client should throw a ConnectionException stating the" +
                    " client ID is not unique");
        }
View Full Code Here

        setTestSystemProperty(ClientProperties.QPID_VERIFY_CLIENT_ID, "true");

        BrokerDetails broker = getBroker();
        try
        {
            Connection con = new AMQConnection(broker.toString(), "guest", "guest",
                                        "client_id", "test");

            Connection con2 = new AMQConnection(broker.toString(), "admin", "admin",
                                        "client_id", "test");
        }
        catch (Exception e)
        {
            fail("Unexpected exception thrown, client id was not unique but usernames were different! " + e.getMessage());
View Full Code Here

        return new junit.framework.TestSuite(ConnectionTest.class);
    }

    public void testExceptionWhenUserPassIsRequired() throws Exception
    {
        AMQConnection conn = null;
        try
        {
            BrokerDetails broker = getBroker();
            String url = "amqp:///test?brokerlist='" + broker + "?sasl_mechs='PLAIN''";
            conn = new AMQConnection(url);
            conn.close();
            fail("Exception should be thrown as user name and password is required");
        }
        catch (Exception e)
        {
            if (!e.getMessage().contains("Username and Password is required for the selected mechanism"))
            {
                if (conn != null && !conn.isClosed())
                {
                    conn.close();
                }
                fail("Incorrect Exception thrown! The exception thrown is : " + e.getMessage());
            }
        }
    }
View Full Code Here

    protected void setUp() throws Exception
    {
        super.setUp();

        AMQConnection con = (AMQConnection) getConnection("guest", "guest");
        AMQProtocolHandler protocolHandler = new AMQProtocolHandler(con);
        protocolHandler.setNetworkConnection(new TestNetworkConnection());

        //don't care about the values set here apart from the dummy IoSession
        _testSession = new TestProtocolSession(protocolHandler , con);
View Full Code Here

    }

    public void tuneConnection(ConnectionTuneParameters params)
    {
        _connectionTuneParameters = params;
        AMQConnection con = getAMQConnection();

        con.setMaximumChannelCount(params.getChannelMax());
        con.setMaximumFrameSize(params.getFrameMax());

        _protocolHandler.initHeartbeats(params.getHeartbeat(), params.getHeartbeatTimeoutFactor());
    }
View Full Code Here

            bOps = bOps.replaceAll(",", "'&");
            bOps = bOps.replaceAll("=", "='");
            buf.append("&").append(bOps).append("'");
        }
       
        Connection con = new AMQConnection(buf.toString());
        return con;
    }
View Full Code Here

    }

    public void setConnectionTuneParameters(ConnectionTuneParameters params)
    {
        _connectionTuneParameters = params;
        AMQConnection con = getAMQConnection();

        con.setMaximumChannelCount(params.getChannelMax());
        con.setMaximumFrameSize(params.getFrameMax());
        _protocolHandler.initHeartbeats((int) params.getHeartbeat());
    }
View Full Code Here

        //Set up a long delay on and large number of retries
        BrokerDetails details = connectionURL.getBrokerDetails(1);
        details.setProperty(BrokerDetails.OPTIONS_RETRY, String.valueOf(RETRIES));
        details.setProperty(BrokerDetails.OPTIONS_CONNECT_DELAY, String.valueOf(DELAY));

        connection = new AMQConnection(connectionURL, null);

        ((AMQConnection) connection).setConnectionListener(this);

        //Start the connection
        connection.start();
View Full Code Here

TOP

Related Classes of org.apache.qpid.client.AMQConnection

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.