Package com.rabbitmq.client.impl

Examples of com.rabbitmq.client.impl.AMQConnection


        {
            IOException lastException = null;
            for (Address addr : addrs) {
                try {
                    FrameHandler frameHandler = createFrameHandlerFactory().create(addr);
                    AMQConnection conn = new GenerousAMQConnection(this, frameHandler, executor);
                    conn.start();
                    return conn;
                } catch (IOException e) {
                    lastException = e;
                }
            }
View Full Code Here


    {
        IOException lastException = null;
        for (Address addr : addrs) {
            try {
                FrameHandler frameHandler = createFrameHandler(addr);
                AMQConnection conn =
                    new AMQConnection(username,
                                      password,
                                      frameHandler,
                                      executor,
                                      virtualHost,
                                      getClientProperties(),
                                      requestedFrameMax,
                                      requestedChannelMax,
                                      requestedHeartbeat,
                                      saslConfig);
                conn.start();
                return conn;
            } catch (IOException e) {
                lastException = e;
            }
        }
View Full Code Here

        List<Frame> frames = new ArrayList<Frame>();
        frames.add(new Frame(AMQP.FRAME_HEADER, 0));
        myFrameHandler.setFrames(frames.iterator());

        try {
            new AMQConnection(factory.getUsername(),
                              factory.getPassword(),
                              myFrameHandler,
                              Executors.newFixedThreadPool(1),
                              factory.getVirtualHost(),
                              factory.getClientProperties(),
View Full Code Here

        frames.add(Frame.fromBodyFragment(channelNumber, contentBody, 0, contentBody.length));
       
        myFrameHandler.setFrames(frames.iterator());
        try {
            new AMQConnection(factory.getUsername(),
                              factory.getPassword(),
                              myFrameHandler,
                              Executors.newFixedThreadPool(1),
                              factory.getVirtualHost(),
                              factory.getClientProperties(),
View Full Code Here

        IOException exception = new SocketTimeoutException();
        _mockFrameHandler.setExceptionOnReadingFrames(exception);
        MyExceptionHandler handler = new MyExceptionHandler();
        assertEquals(0, _mockFrameHandler.countHeadersSent());
        try {
            new AMQConnection(factory.getUsername(),
                    factory.getPassword(),
                    _mockFrameHandler,
                    Executors.newFixedThreadPool(1),
                    factory.getVirtualHost(),
                    factory.getClientProperties(),
View Full Code Here

    public void testConnectionHangInNegotiation() {
        this._mockFrameHandler.setTimeoutCount(10); // to limit hang
        MyExceptionHandler handler = new MyExceptionHandler();
        assertEquals(0, this._mockFrameHandler.countHeadersSent());
        try {
            new AMQConnection(factory.getUsername(),
                    factory.getPassword(),
                    this._mockFrameHandler,
                    Executors.newFixedThreadPool(1),
                    factory.getVirtualHost(),
                    factory.getClientProperties(),
View Full Code Here

    public void testWillShutDownExecutor() throws IOException {
        ConnectionFactory cf = new ConnectionFactory();
        ExecutorService executor = Executors.newFixedThreadPool(8);
        cf.setSharedExecutor(executor);

        AMQConnection conn1 = (AMQConnection)cf.newConnection();
        assertFalse(conn1.willShutDownConsumerExecutor());

        AMQConnection conn2 = (AMQConnection)cf.newConnection(Executors.newSingleThreadExecutor());
        assertFalse(conn2.willShutDownConsumerExecutor());

        AMQConnection conn3 = (AMQConnection)cf.newConnection((ExecutorService)null);
        assertTrue(conn3.willShutDownConsumerExecutor());

        cf.setSharedExecutor(null);

        AMQConnection conn4 = (AMQConnection)cf.newConnection();
        assertTrue(conn4.willShutDownConsumerExecutor());
    }
View Full Code Here

        IOException exception = new SocketTimeoutException();
        _mockFrameHandler.setExceptionOnReadingFrames(exception);
        assertEquals(0, _mockFrameHandler.countHeadersSent());
        try {
            ConnectionParams params = factory.params(Executors.newFixedThreadPool(1));
            new AMQConnection(params, _mockFrameHandler).start();
            fail("Connection should have thrown exception");
        } catch(IOException signal) {
           // As expected
        }
        assertEquals(1, _mockFrameHandler.countHeadersSent());
View Full Code Here

    public void testConnectionHangInNegotiation() {
        this._mockFrameHandler.setTimeoutCount(10); // to limit hang
        assertEquals(0, this._mockFrameHandler.countHeadersSent());
        try {
            ConnectionParams params = factory.params(Executors.newFixedThreadPool(1));
            new AMQConnection(params, this._mockFrameHandler).start();
            fail("Connection should have thrown exception");
        } catch(IOException signal) {
           // As expected
        }
        assertEquals(1, this._mockFrameHandler.countHeadersSent());
View Full Code Here

        List<Frame> frames = new ArrayList<Frame>();
        frames.add(new Frame(AMQP.FRAME_HEADER, 0));
        myFrameHandler.setFrames(frames.iterator());

        try {
            new AMQConnection(factory.params(Executors.newFixedThreadPool(1)), myFrameHandler).start();
        } catch (IOException e) {
            UnexpectedFrameError unexpectedFrameError = findUnexpectedFrameError(e);
            assertNotNull(unexpectedFrameError);
            assertEquals(AMQP.FRAME_HEADER, unexpectedFrameError.getReceivedFrame().type);
            assertEquals(AMQP.FRAME_METHOD, unexpectedFrameError.getExpectedFrameType());
View Full Code Here

TOP

Related Classes of com.rabbitmq.client.impl.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.