@Test
public void testSubscribe() {

    // verify listener
    final URL[] notifyUrl = new URL[1];
    for (int i = 0; i < 10; i++) {
        registry.register(serviceUrl);
        registry.subscribe(consumerUrl, urls -> {
            notifyUrl[0] = urls.get(0);
            Map<URL, Set<NotifyListener>> subscribed = registry.getSubscribed();
            assertEquals(consumerUrl, subscribed.keySet().iterator().next());
        });
        if (!EMPTY_PROTOCOL.equalsIgnoreCase(notifyUrl[0].getProtocol())) {
            break;
        }
    }
    assertEquals(serviceUrl.toFullString(), notifyUrl[0].toFullString());
}