assertNotNull(cm.getConnection(remotingSessionId));
assertTrue(cm.containsSession(remotingSessionId));
   public void testCallbackFailure() throws Exception   {      if (!ServerManagement.isRemote()) return;            //We need to disable exception listener otherwise it will clear up the connection itself            ObjectName connectorName = localServer.getServerPeer().getConnector();            ConnectionManager cm = localServer.getServerPeer().getConnectionManager();            localServer.getServerPeer().getServer().invoke(connectorName, "removeConnectionListener",                                                     new Object[] {cm},                                                     new String[] {"org.jboss.remoting.ConnectionListener"});              InitialContext ic = new InitialContext(InVMInitialContextFactory.getJNDIEnvironment());            ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");            Queue queue = (Queue)ic.lookup("/queue/Queue");            CreateHangingConsumerCommand command = new CreateHangingConsumerCommand(cf, queue);            String remotingSessionId = (String)remoteServer.executeCommand(command);            remoteServer.exit();            //we have removed the exception listener so the server side resouces shouldn't be cleared up            Thread.sleep(20000);                       assertNotNull(cm.getConnection(remotingSessionId));            //Now we send a message which should prompt delivery to the dead consumer causing      //an exception which should cause connection cleanup                        Connection conn = cf.createConnection();            Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);              MessageProducer prod = sess.createProducer(queue);            prod.send(sess.createMessage());      prod.send(sess.createMessage());      prod.send(sess.createMessage());      prod.send(sess.createMessage());      prod.send(sess.createMessage());      prod.send(sess.createMessage());      prod.send(sess.createMessage());      prod.send(sess.createMessage());      prod.send(sess.createMessage());      prod.send(sess.createMessage());      prod.send(sess.createMessage());            Thread.sleep(10000);            assertNull(cm.getConnection(remotingSessionId));                     }