Session s = c.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageProducer p = s.createProducer(queue1);
// create a Bytes foreign message
SimpleJMSTextMessage txt = new SimpleJMSTextMessage("hello from Brazil!");
txt.setJMSDestination(null);
p.send(txt);
assertNotNull(txt.getJMSDestination());
MessageConsumer cons = s.createConsumer(queue1);
c.start();
TextMessage tm = (TextMessage)cons.receive();
assertNotNull(tm);
assertEquals("hello from Brazil!", txt.getText());
}
catch(Exception e)
{
e.printStackTrace();
}