MulticastRegistry extends FailbackRegistry { @Override public void subscribe(URL url, NotifyListener listener) { super.subscribe(url, listener); subscribed(url, listener); } MulticastRegistry(URL url); @Override void doRegister(URL url); @Override void doUnregister(URL url); @Override void doSubscribe(URL url, final NotifyListener listener); @Override void doUnsubscribe(URL url, NotifyListener listener); @Override boolean isAvailable(); @Override void destroy(); @Override void register(URL url); @Override void unregister(URL url); @Override void subscribe(URL url, NotifyListener listener); @Override void unsubscribe(URL url, NotifyListener listener); @Override List<URL> lookup(URL url); MulticastSocket getMulticastSocket(); Map<URL, Set<URL>> getReceived();  }
@Test public void testSubscribe() { 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()); }