Session consumerSession = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
// Make sure temporary queue cannot be used after it has been deleted
TemporaryQueue tempQueue = producerSession.createTemporaryQueue();
MessageProducer producer = producerSession.createProducer(tempQueue);
MessageConsumer consumer = consumerSession.createConsumer(tempQueue);
conn.start();
final String messageText = "This is a message";
Message m = producerSession.createTextMessage(messageText);
producer.send(m);
TextMessage m2 = (TextMessage)consumer.receive(2000);
ProxyAssertSupport.assertNotNull(m2);
ProxyAssertSupport.assertEquals(messageText, m2.getText());
consumer.close();
tempQueue.delete();
conn.close();
conn = JMSTestCase.cf.createConnection("guest", "guest");
try
{
producer.send(m);