// wait until response is received
CountDownLatch latch = (CountDownLatch) session.getAttribute("latch");
latch.await();
// close the session
CloseFuture closeFuture = session.close(false);
System.out.println("session.close called");
//Thread.sleep(5);
// wait for session close and then dispose the connector
closeFuture.addListener(new IoFutureListener<IoFuture>() {
public void operationComplete(IoFuture future) {
System.out.println("managed session count=" + connector.getManagedSessionCount());
System.out.println("Disposing connector ...");
connector.dispose(true);
System.out.println("Disposing connector ... *finished*");
}
});
closeFuture.awaitUninterruptibly();
acceptor.dispose(true);
List threadsAfter = getThreadNames();
System.out.println("threadsBefore = " + threadsBefore);