}
@Test
- public void testNegotiationFailedNoReconnect() throws Exception {
+ public void testNegotiationFailedReconnect() throws Exception {
final Promise<Boolean> p = new DefaultPromise<>(GlobalEventExecutor.INSTANCE);
this.dispatcher = getServerDispatcher(p);
}
};
}
- }, new DefaultPromise<SimpleSession>(GlobalEventExecutor.INSTANCE), eventLoopGroup);
+ }, new DefaultPromise<>(GlobalEventExecutor.INSTANCE), eventLoopGroup);
final ReconnectStrategyFactory reconnectStrategyFactory = mock(ReconnectStrategyFactory.class);
final ReconnectStrategy reconnectStrategy = getMockedReconnectStrategy();
});
- // Only one strategy should be created for initial connect, no more = no reconnects
- verify(reconnectStrategyFactory, times(1)).createReconnectStrategy();
+ // Reconnect strategy should be consulted at least twice, for initial connect and reconnect attempts after drop
+ verify(reconnectStrategyFactory, timeout((int) TimeUnit.MINUTES.toMillis(3)).atLeast(2)).createReconnectStrategy();
}
private SimpleDispatcher getClientDispatcher() {
final Channel channel, final Promise<SimpleSession> promise) {
return new SimpleSessionNegotiator(promise, channel);
}
- }, new DefaultPromise<SimpleSession>(GlobalEventExecutor.INSTANCE), eventLoopGroup);
+ }, new DefaultPromise<>(GlobalEventExecutor.INSTANCE), eventLoopGroup);
}
private ReconnectStrategy getMockedReconnectStrategy() throws Exception {