prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
   public void testMultipleConcurrentConsumers() throws Exception   {      consumerConnection.start();      Session sess1 = consumerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);      Session sess2 = consumerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);      Session sess3 = consumerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);            MessageConsumer cons1 = sess1.createConsumer(topic);      MessageConsumer cons2 = sess2.createConsumer(topic);      MessageConsumer cons3 = sess3.createConsumer(topic);              final int NUM_MESSAGES = 100;            class Receiver implements Runnable      {         Receiver(MessageConsumer c)         {            cons = c;         }         MessageConsumer cons;         boolean failed;         public void run()         {            try            {               for (int i = 0; i < NUM_MESSAGES; i++)               {                  TextMessage m = (TextMessage)cons.receive(5000);                                    if (m == null)                  {                     log.error("Didn't receive all the messages");                     failed = true;                     break;                  }                  log.trace("received message");                  if (!m.getText().equals("testing"))                  {                                          failed = true;                  }               }            }            catch (Exception e)            {               log.error("Failed in receiving messages", e);               failed = true;            }         }      }                  Receiver rec1 = new Receiver(cons1);      Receiver rec2 = new Receiver(cons2);      Receiver rec3 = new Receiver(cons3);            Thread t1 = new Thread(rec1);      Thread t2 = new Thread(rec2);      Thread t3 = new Thread(rec3);            log.trace("Starting threads");            t1.start();      t2.start();      t3.start();            log.trace("Sending messages to topic");            producerConnection.start();      Session prodSession = producerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);      MessageProducer prod = prodSession.createProducer(topic);            for (int i = 0; i < NUM_MESSAGES; i++)      {         Message m = prodSession.createTextMessage("testing");         prod.send(m);         log.trace("Sent message to topic");      }            t1.join();      t2.join();      t3.join();            sess1.close();      sess2.close();      sess3.close();      prodSession.close();            assertTrue(!rec1.failed);      assertTrue(!rec2.failed);      assertTrue(!rec3.failed);   }