@Test public void testConnectorRecoversWhenGossipRouterReconnects() throws Exception { final AtomicInteger counter1 = new AtomicInteger(0); final AtomicInteger counter2 = new AtomicInteger(0); connector1.subscribe(String.class.getName(), new CountingCommandHandler<String>(counter1)); connector1.connect(20); assertTrue( "Expected connector 1 to connect within 10 seconds", connector1.awaitJoined(10, TimeUnit.SECONDS)); connector2.subscribe(Long.class.getName(), new CountingCommandHandler<Long>(counter2)); connector2.connect(80); assertTrue("Connector 2 failed to connect", connector2.awaitJoined()); // the nodes joined, but didn't detect eachother gossipRouter.start(); // now, they should detect eachother and start syncing their state waitForConnectorSync(60); }