TextMessage m2 = (TextMessage)cons.receive(3000);
TextMessage m2 = (TextMessage)cons.receive(1000);
   public void test1PCReceiveRollback() throws Exception   {      if (ServerManagement.isRemote()) return;            XAConnection conn = null;      Connection conn2 = null;            try      {         conn2 = cf.createConnection();         Session sessProducer = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);         MessageProducer prod  = sessProducer.createProducer(queue);         Message m = sessProducer.createTextMessage("XATest2");         prod.send(m);                           conn = cf.createXAConnection();         conn.start();                     tm.begin();                  XASession sess = conn.createXASession();         XAResource res = sess.getXAResource();                  Transaction tx = tm.getTransaction();         tx.enlistResource(res);         MessageConsumer cons = sess.createConsumer(queue);                  TextMessage m2 = (TextMessage)cons.receive(3000);                  assertNotNull(m2);         assertEquals("XATest2", m2.getText());                  tx.rollback();                  //Message should be redelivered                  //New tx         tm.begin();         tx = tm.getTransaction();         tx.enlistResource(res);                  TextMessage m3 = (TextMessage)cons.receive(3000);                  assertNotNull(m3);         assertEquals("XATest2", m3.getText());                  assertTrue(m3.getJMSRedelivered());                  tm.commit();      }      finally      {         if (conn != null)         {            conn.close();         }         if (conn2 != null)         {            conn2.close();         }      }         }