assertNotNull(expectedMessage);  assertEquals(123456, ((JBossMessage)expectedMessage).getMessageID());
assertNull(expectedMessage);
   public void testExpirationOnReceive() throws Exception   {      expectedMessage = new JBossMessage(123456);      queueProducer.send(queueProducerSession.createMessage(), DeliveryMode.NON_PERSISTENT, 4, 2000);      // allow the message to expire      Thread.sleep(3000);      final Latch latch = new Latch();      // blocking read for a while to make sure I don't get anything, not even a null      Thread receiverThread = new Thread(new Runnable()      {         public void run()         {            try            {               log.trace("Attempting to receive");               expectedMessage = queueConsumer.receive();               log.trace("Receive exited without exception:" + expectedMessage);            }            catch(Exception e)            {               log.trace("receive() exits with an exception", e);            }            catch(Throwable t)            {               log.trace("receive() exits with an throwable", t);            }            finally            {               latch.release();            }         }      }, "receiver thread");      receiverThread.start();      Thread.sleep(3000);      receiverThread.interrupt();      // wait for the reading thread to conclude      latch.acquire();      log.trace("Expected message:" + expectedMessage);            assertNotNull(expectedMessage);      assertEquals(123456, ((JBossMessage)expectedMessage).getMessageID());   }