Connection conn = factory.createConnection("guest", "password");
Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
String name = "org.apache.activemq:BrokerName=localhost,Type=TempTopic";
try {
conn.start();
TemporaryTopic temp = sess.createTemporaryTopic();
name += ",Destination=" + temp.getTopicName().replaceAll(":", "_");
fail("Should have failed creating a temp topic");
} catch (Exception ignore) {}
ObjectName objName = new ObjectName(name);