@Test
public void testClosingTemporaryTopicDeletesQueue() throws JMSException, ActiveMQException {
conn = cf.createConnection();
Assert.assertEquals(1, server.getRemotingService().getConnections().size());
session1 = (ActiveMQSession) conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
ActiveMQTemporaryTopic topic = (ActiveMQTemporaryTopic) session1.createTemporaryTopic();
String address = topic.getAddress();
session1.close();
conn.close();
conn2 = cf.createConnection();
session2 = (ActiveMQSession) conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
ClientSession cs = session2.getCoreSession();
try {
cs.createConsumer(address);
fail("the address from the TemporaryTopic still exists!");
} catch (ActiveMQException e) {
assertEquals("expecting 'queue does not exist'", ActiveMQExceptionType.QUEUE_DOES_NOT_EXIST, e.getType());
}
}