use of org.apache.activemq.transport.amqp.client.AmqpConnectionListener in project activemq-artemis by apache.
the class AmqpBrokerReuqestedHearbeatsTest method testClientWithoutHeartbeatsGetsDropped.
@Test(timeout = 60000)
public void testClientWithoutHeartbeatsGetsDropped() throws Exception {
final CountDownLatch disconnected = new CountDownLatch(1);
AmqpClient client = createAmqpClient();
assertNotNull(client);
AmqpConnection connection = addConnection(client.createConnection());
assertNotNull(connection);
connection.setIdleProcessingDisabled(true);
connection.setListener(new AmqpConnectionListener() {
@Override
public void onException(Throwable ex) {
disconnected.countDown();
}
});
connection.connect();
assertEquals(1, server.getConnectionCount());
assertTrue(disconnected.await(30, TimeUnit.SECONDS));
connection.close();
Wait.assertEquals(0, server::getConnectionCount);
}
use of org.apache.activemq.transport.amqp.client.AmqpConnectionListener in project activemq-artemis by apache.
the class AmqpBrokerReuqestedHearbeatsTest method testClientWithHeartbeatsStaysAlive.
@Test(timeout = 60000)
public void testClientWithHeartbeatsStaysAlive() throws Exception {
final CountDownLatch disconnected = new CountDownLatch(1);
AmqpClient client = createAmqpClient();
assertNotNull(client);
AmqpConnection connection = addConnection(client.createConnection());
assertNotNull(connection);
connection.setListener(new AmqpConnectionListener() {
@Override
public void onException(Throwable ex) {
disconnected.countDown();
}
});
connection.connect();
assertEquals(1, server.getConnectionCount());
assertFalse(disconnected.await(5, TimeUnit.SECONDS));
connection.close();
Wait.assertEquals(0, server::getConnectionCount);
}
Aggregations