public void shouldHandleRecoveryFailureFromChannelListener() throws Throwable {
final AtomicBoolean shutdownCalled = new AtomicBoolean();
config = new Config().withRetryPolicy(
RetryPolicies.retryAlways().withInterval(Duration.millis(10)))
.withRecoveryPolicy(RecoveryPolicies.recoverAlways())
.withChannelListeners(new DefaultChannelListener() {
@Override
public void onRecovery(Channel channel) {
if (!shutdownCalled.get() && channel == mockChannel(2).proxy) {
ShutdownSignalException e = nonRetryableChannelShutdownSignal();
shutdownCalled.set(true);