Mechanical code cleanup (commons)
[controller.git] / opendaylight / commons / protocol-framework / src / test / java / org / opendaylight / protocol / framework / ServerTest.java
index 63026e384c498ce12dca810c94886f9a562215d8..331e94949e2506a470ad31dae5de31cb12d256f3 100644 (file)
@@ -251,7 +251,7 @@ public class ServerTest {
     }
 
     @Test
-    public void testNegotiationFailedNoReconnect() throws Exception {
+    public void testNegotiationFailedReconnect() throws Exception {
         final Promise<Boolean> p = new DefaultPromise<>(GlobalEventExecutor.INSTANCE);
 
         this.dispatcher = getServerDispatcher(p);
@@ -277,7 +277,7 @@ public class ServerTest {
                     }
                 };
             }
-        }, new DefaultPromise<SimpleSession>(GlobalEventExecutor.INSTANCE), eventLoopGroup);
+        }, new DefaultPromise<>(GlobalEventExecutor.INSTANCE), eventLoopGroup);
 
         final ReconnectStrategyFactory reconnectStrategyFactory = mock(ReconnectStrategyFactory.class);
         final ReconnectStrategy reconnectStrategy = getMockedReconnectStrategy();
@@ -292,8 +292,8 @@ public class ServerTest {
                 });
 
 
-        // 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() {
@@ -303,7 +303,7 @@ public class ServerTest {
                                                                          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 {