Search in sources :

Example 21 with AmqpValidator

use of org.apache.activemq.transport.amqp.client.AmqpValidator in project activemq-artemis by apache.

the class AmqpBrokerReuqestedHearbeatsTest method testBrokerSendsHalfConfiguredIdleTimeoutWhenClientSendsTimeout.

@Test(timeout = 60000)
public void testBrokerSendsHalfConfiguredIdleTimeoutWhenClientSendsTimeout() throws Exception {
    AmqpClient client = createAmqpClient();
    assertNotNull(client);
    client.setValidator(new AmqpValidator() {

        @Override
        public void inspectOpenedResource(Connection connection) {
            assertEquals("Broker did not send half the idle timeout", TEST_IDLE_TIMEOUT / 2, connection.getTransport().getRemoteIdleTimeout());
        }
    });
    AmqpConnection connection = addConnection(client.createConnection());
    connection.setIdleTimeout(TEST_IDLE_TIMEOUT * 4);
    assertNotNull(connection);
    connection.connect();
    connection.getStateInspector().assertValid();
    connection.close();
}
Also used : AmqpConnection(org.apache.activemq.transport.amqp.client.AmqpConnection) Connection(org.apache.qpid.proton.engine.Connection) AmqpConnection(org.apache.activemq.transport.amqp.client.AmqpConnection) AmqpClient(org.apache.activemq.transport.amqp.client.AmqpClient) AmqpValidator(org.apache.activemq.transport.amqp.client.AmqpValidator) Test(org.junit.Test)

Aggregations

AmqpClient (org.apache.activemq.transport.amqp.client.AmqpClient)21 AmqpConnection (org.apache.activemq.transport.amqp.client.AmqpConnection)21 AmqpValidator (org.apache.activemq.transport.amqp.client.AmqpValidator)21 Test (org.junit.Test)21 AmqpSession (org.apache.activemq.transport.amqp.client.AmqpSession)15 AmqpReceiver (org.apache.activemq.transport.amqp.client.AmqpReceiver)8 Receiver (org.apache.qpid.proton.engine.Receiver)8 Map (java.util.Map)7 AmqpSender (org.apache.activemq.transport.amqp.client.AmqpSender)7 Sender (org.apache.qpid.proton.engine.Sender)7 Connection (org.apache.qpid.proton.engine.Connection)6 HashMap (java.util.HashMap)5 Source (org.apache.qpid.proton.amqp.messaging.Source)5 ErrorCondition (org.apache.qpid.proton.amqp.transport.ErrorCondition)5 RemotingConnection (org.apache.activemq.artemis.spi.core.protocol.RemotingConnection)4 AmqpMessage (org.apache.activemq.transport.amqp.client.AmqpMessage)4 Delivery (org.apache.qpid.proton.engine.Delivery)4 Symbol (org.apache.qpid.proton.amqp.Symbol)3 CountDownLatch (java.util.concurrent.CountDownLatch)2 DescribedType (org.apache.qpid.proton.amqp.DescribedType)2