@Test
public void testRecover() throws Exception {

    CountDownLatch countDownLatch = new CountDownLatch(4);
    final AtomicReference<Boolean> notified = new AtomicReference<Boolean>(false);
    NotifyListener listener = new NotifyListener() {
        @Override
        public void notify(List<URL> urls) {
            notified.set(Boolean.TRUE);
        }
    };
    MockRegistry mockRegistry = new MockRegistry(registryUrl, countDownLatch);
    mockRegistry.register(serviceUrl);
    mockRegistry.subscribe(serviceUrl, listener);
    Assertions.assertEquals(1, mockRegistry.getRegistered().size());
    Assertions.assertEquals(1, mockRegistry.getSubscribed().size());
    mockRegistry.recover();
    countDownLatch.await();
    Assertions.assertEquals(0, mockRegistry.getFailedRegistered().size());
    FailbackRegistry.Holder h = new FailbackRegistry.Holder(registryUrl, listener);
    Assertions.assertNull(mockRegistry.getFailedSubscribed().get(h));
    Assertions.assertEquals(countDownLatch.getCount(), 0);
}