doAnswer(failNTimes(4, retryableChannelShutdownSignal(), null, mockChannel(1).channelHandler)).when(
mockChannel(1).delegate)
.basicCancel("foo-tag");
final Waiter waiter = new Waiter();
waiter.expectResumes(2);
for (int i = 0; i < 2; i++)
runInThread(new Runnable() {
public void run() {
try {
performInvocation();
waiter.resume();
} catch (Throwable t) {
waiter.fail(t);
}
}
});
waiter.await(2000);
// Even though both threads will fail twice, only one thread will perform recovery
verifyCxnCreations(1);
verifyChannelCreations(1, 3);
verifyChannelCreations(2, 1);