final CountDownLatch deliverLatch = new CountDownLatch(1);
try {
subscriber.subscribe(topic, subid, CreateOrAttach.CREATE_OR_ATTACH);
sleepDeliveryManager(wakeupLatch);
subscriber.asyncCloseSubscription(topic, subid, new Callback<Void>() {
@Override
public void operationFinished(Object ctx, Void resultOfOperation) {
closeLatch.countDown();
}
@Override