### Question:
ZookeeperDiscoveryService implements DiscoveryService { @Override public synchronized void unsubscribe(SubscribeInfo info) { try { NodeChangeListener listener = listeners.remove(info); if (listener != null) { zkClient.removeChildNodeChangeListener(listener); logger.info("Unsubscribe on zookeeper[{}]: remoteAppkey={}, serviceName={}", address, info.getRemoteAppkey(), info.getServiceName()); } else { logger.info("Have unsubscribe on zookeeper[{}]: remoteAppkey={}, serviceName={}", address, info.getRemoteAppkey(), info.getServiceName()); } } catch (Throwable e) { throw new RegistryException("Failed to unsubscribe service " + info.getServiceName(), e); } } ZookeeperDiscoveryService(String address); @Override synchronized void subscribe(SubscribeInfo info, ProviderListener notifyListener); @Override synchronized void unsubscribe(SubscribeInfo info); @Override void destroy(); @Override void setRegistryPolicy(RegistryPolicy registryPolicy);  }### Answer:
@Test public void testUnsubscribe() throws InterruptedException { RegistryInfo registryInfo = genRegistryInfo(); SubscribeInfo subscribeInfo = genSubscribeInfo(); discoveryService.unsubscribe(subscribeInfo); MockNotifyListener listener = new MockNotifyListener(); registryService.register(registryInfo); discoveryService.subscribe(subscribeInfo, listener); List<Provider> providers = listener.getProviders(); Assert.assertEquals(1, providers.size()); Assert.assertEquals(9001, providers.get(0).getPort()); discoveryService.unsubscribe(subscribeInfo); registryService.unregister(registryInfo); Thread.sleep(100); providers = listener.getProviders(); Assert.assertEquals(1, providers.size()); Assert.assertEquals(9001, providers.get(0).getPort()); }