});
}  Listener list = new Listener(); c2.setMessageListener(list);
   public void testReceive2() throws Exception   {      Connection conn = null;       try       {          conn = cf.createConnection();          Session s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);          s.createConsumer(queue);          conn.start();          MessageProducer p = s.createProducer(queue);          Message m = s.createTextMessage("1");          p.send(m);          MessageConsumer c2 = s.createConsumer(queue);          final Set received = new HashSet();          c2.setMessageListener(new MessageListener()          {             public void onMessage(Message m)             {                received.add(m);                received.notify();             }          });          synchronized(received)          {             received.wait(3000);          }          assertEquals(1, received.size());          Message r = (Message)received.iterator().next();          assertEquals(m.getJMSMessageID(), r.getJMSMessageID());       }       finally       {          if (conn != null)          {             conn.close();          }       }   }