@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));
}