log.info("timeToSleep = " + timeToSleep + " ms, elapsed = " + elapsed + " ms");
log.trace("timeToSleep = " + timeToSleep + " ms, elapsed = " + elapsed + " ms");
   public void testTimeoutReceiveOnClose() throws Exception   {      if (log.isTraceEnabled()) log.trace("testTimeoutReceiveOnClose");      consumerConnection.start();      final Latch latch = new Latch();      final long timeToSleep = 1000;      Thread closerThread = new Thread(new Runnable()      {         public void run()         {            try            {               // this is needed to make sure the main thread has enough time to block               Thread.sleep(timeToSleep);               topicConsumer.close();            }            catch(Exception e)            {               log.error(e);            }            finally            {               latch.release();            }         }      }, "closing thread");      closerThread.start();      long t1 = System.currentTimeMillis();      assertNull(topicConsumer.receive(1500));      long elapsed = System.currentTimeMillis() - t1;      log.info("timeToSleep = " + timeToSleep + " ms, elapsed = " + elapsed + " ms");      // make sure it didn't wait 5 seconds to return null; allow 10 ms for overhead      assertTrue(elapsed <= timeToSleep + 100);      // wait for the closing thread to finish      latch.acquire();   }