@Override
    public void destroy() {
        super.destroy();

        // remove child listener
        Set<URL> urls = zkListeners.keySet();
        for (URL url : urls) {
            ConcurrentMap<NotifyListener, ChildListener> map = zkListeners.get(url);
            if (CollectionUtils.isEmptyMap(map)) {
                continue;
            }
            Collection<ChildListener> childListeners = map.values();
            if (CollectionUtils.isEmpty(childListeners)) {
                continue;
            }
            if (ANY_VALUE.equals(url.getServiceInterface())) {
                String root = toRootPath();
                childListeners.stream().forEach(childListener -> zkClient.removeChildListener(root, childListener));
            } else {
                for (String path : toCategoriesPath(url)) {
                    childListeners.stream().forEach(childListener -> zkClient.removeChildListener(path, childListener));
                }
            }
        }
        zkListeners.clear();

        // Just release zkClient reference, but can not close zk client here for zk client is shared somewhere else.
        // See org.apache.dubbo.remoting.zookeeper.AbstractZookeeperTransporter#destroy()
        zkClient = null;
    }
@Test
    void testDestroy() {
        zookeeperRegistry.destroy();
        assertThat(zookeeperRegistry.isAvailable(), is(false));
    }