@Override
    public boolean registry(ServiceInstance serviceInstance) {
        checkDiscoveryState();
        if (getZkClient().isStateOk()) {
            return registrySync(serviceInstance);
        }
        return registryAsync(serviceInstance);
    }
@Test
    public void registry() throws Exception {
        final DefaultServiceInstance instance = new DefaultServiceInstance("localhost", "127.0.0.1", 8080,
                Collections.emptyMap(), serviceName);
        final boolean result = zkDiscoveryClient.registry(instance);
        Assert.assertTrue(result);
        Mockito.verify(serviceDiscovery, Mockito.times(1)).registerService(Mockito.any());
    }