final RecoveryListener listener = new RecoveryListener() {
public void handleRecovery(Recoverable recoverable) {
latch.countDown();
}
};
AutorecoveringChannel ch1 = (AutorecoveringChannel) connection.createChannel();
ch1.addRecoveryListener(listener);
AutorecoveringChannel ch2 = (AutorecoveringChannel) connection.createChannel();
ch2.addRecoveryListener(listener);
assertTrue(ch1.isOpen());
assertTrue(ch2.isOpen());
closeAndWaitForRecovery();
expectChannelRecovery(ch1);
expectChannelRecovery(ch2);
wait(latch);
}