final CountDownLatch awaitMessages = new CountDownLatch(1);
final AtomicReference<Throwable> listenerCaughtException = new AtomicReference<Throwable>();
AMQConnection con = (AMQConnection) getConnection("guest", "guest");
AMQSession consumerSession = (AMQSession) con.createSession(false, Session.CLIENT_ACKNOWLEDGE);
AMQQueue queue = new AMQQueue(con.getDefaultQueueExchangeName(), new AMQShortString("testQ"));
MessageConsumer consumer = consumerSession.createConsumer(queue);
consumer.setMessageListener(new MessageListener()
{
public void onMessage(Message message)