ConsulRegistry extends FailbackRegistry { @Override public void subscribe(URL url, NotifyListener listener) { if (isProviderSide(url)) { return; } super.subscribe(url, listener); } ConsulRegistry(URL url); @Override void register(URL url); @Override void doRegister(URL url); @Override void unregister(URL url); @Override void doUnregister(URL url); @Override void subscribe(URL url, NotifyListener listener); @Override void doSubscribe(URL url, NotifyListener listener); @Override void unsubscribe(URL url, NotifyListener listener); @Override void doUnsubscribe(URL url, NotifyListener listener); @Override List<URL> lookup(URL url); @Override boolean isAvailable(); @Override void destroy();  }
@Test public void testSubscribe() { NotifyListener listener = mock(NotifyListener.class); consulRegistry.subscribe(serviceUrl, listener); Map<URL, Set<NotifyListener>> subscribed = consulRegistry.getSubscribed(); assertThat(subscribed.size(), is(1)); assertThat(subscribed.get(serviceUrl).size(), is(1)); consulRegistry.unsubscribe(serviceUrl, listener); subscribed = consulRegistry.getSubscribed(); assertThat(subscribed.size(), is(1)); assertThat(subscribed.get(serviceUrl).size(), is(0)); }