@Test
public void testUnsubscribe() {

    // subscribe first
    registry.subscribe(consumerUrl, new NotifyListener() {
        @Override
        public void notify(List<URL> urls) {
            // do nothing
        }
    });
    // then unsubscribe
    registry.unsubscribe(consumerUrl, new NotifyListener() {
        @Override
        public void notify(List<URL> urls) {
            Map<URL, Set<NotifyListener>> subscribed = registry.getSubscribed();
            Set<NotifyListener> listeners = subscribed.get(consumerUrl);
            assertTrue(listeners.isEmpty());
            Map<URL, Set<URL>> received = registry.getReceived();
            assertTrue(received.get(consumerUrl).isEmpty());
        }
    });
}