durable2.close();
   public void testDurableSubscriptionReconnectDifferentClientID() throws Exception   {      final String CLIENT_ID1 = "test-client-id1";      final String CLIENT_ID2 = "test-client-id2";      Connection conn1 = null;      Connection conn2 = null;      try      {         conn1 = cf.createConnection();         conn1.setClientID(CLIENT_ID1);         Session sess1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE);         MessageProducer prod = sess1.createProducer(topic);         prod.setDeliveryMode(DeliveryMode.PERSISTENT);         MessageConsumer durable = sess1.createDurableSubscriber(topic, "mySubscription");         conn1.start();         final int NUM_MESSAGES = 50;         for (int i = 0; i < NUM_MESSAGES; i++)         {            TextMessage tm = sess1.createTextMessage("hello");            prod.send(topic, tm);         }         final int NUM_TO_RECEIVE1 = 22;         for (int i = 0; i < NUM_TO_RECEIVE1; i++)         {            TextMessage tm = (TextMessage)durable.receive(1500);            if (tm == null)            {               fail();            }         }         //Close the connection         conn1.close();         conn1 = null;         conn2 = cf.createConnection();         conn2.setClientID(CLIENT_ID2);         Session sess2 = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);         //Re-subscribe to the subscription         MessageConsumer durable2 = sess2.createDurableSubscriber(topic, "mySubscription");         conn2.start();         int count = 0;         while (true)         {            TextMessage tm = (TextMessage)durable2.receive(1500);            if (tm == null)            {               break;            }            count++;         }         assertEquals(0, count);         sess2.unsubscribe("mySubscription");      }      finally      {         if (conn1 != null)         {            conn1.close();         }         if (conn2 != null)         {            conn2.close();         }      }   }