Session sess = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE);
Session sess1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE);
   public void testNoLocal() throws Exception   {      if (log.isTraceEnabled()) log.trace("testNoLocal");      Connection conn1 = cf.createConnection();      Session sess = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE);      MessageProducer producer = sess.createProducer(topic);      producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);      MessageConsumer consumer1 = sess.createConsumer(topic, null, true);      Connection conn2 = cf.createConnection();      Session sess2 = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);      assertEquals(Session.AUTO_ACKNOWLEDGE, sess2.getAcknowledgeMode());      MessageConsumer consumer2 = sess.createConsumer(topic, null, true);      MessageConsumer consumer3 = sess.createConsumer(topic, null, false);      //Consumer 1 should not get the message but consumers 2 and 3 should      conn1.start();      conn2.start();      class TestRunnable implements Runnable      {         boolean exceptionThrown;         public Message m;         MessageConsumer consumer;         TestRunnable(MessageConsumer consumer)         {            this.consumer = consumer;         }         public void run()         {            try            {               m = consumer.receive(3000);            }            catch (Exception e)            {               exceptionThrown = true;            }         }      }      TestRunnable tr1 = new TestRunnable(consumer1);      TestRunnable tr2 = new TestRunnable(consumer2);      TestRunnable tr3 = new TestRunnable(consumer3);      Thread t1 = new Thread(tr1);      Thread t2 = new Thread(tr2);      Thread t3 = new Thread(tr3);      t1.start();      t2.start();      t3.start();      Message m2 = sess.createTextMessage("Hello");      producer.send(m2);      t1.join();      t2.join();      t3.join();      assertTrue(!tr1.exceptionThrown);      assertTrue(!tr2.exceptionThrown);      assertTrue(!tr3.exceptionThrown);      //TODO this test won't work until message selectors are implemented in core      //assertNull(tr1.m);      assertNotNull(tr2.m);      assertNotNull(tr3.m);      conn1.close();      conn2.close();   }