@Test(timeout=60000)
public void testConnectionsAreClosed() throws Exception {
ActiveMQAdmin.enableJMSFrameTracing();
final ConnectorViewMBean connector = getProxyToConnectionView(getTargetConnectorName());
LOG.info("Current number of Connections is: {}", connector.connectionCount());
ArrayList<Connection> connections = new ArrayList<Connection>();
for (int i = 0; i < 10; i++) {
connections.add(createConnection(null));
}
LOG.info("Current number of Connections is: {}", connector.connectionCount());
for (Connection connection : connections) {
connection.close();
}
assertTrue("Should have no connections left.", Wait.waitFor(new Wait.Condition() {
@Override
public boolean isSatisified() throws Exception {
LOG.info("Current number of Connections is: {}", connector.connectionCount());
return connector.connectionCount() == 0;
}
}));
}