public static void main(String... args) throws Exception {
        Map<String, ServiceProvider<ExampleService>> providers = Maps.newHashMap();
        CuratorFramework client = null;
        ServiceDiscovery<ExampleService> serviceDiscovery = null;

        client = CuratorFrameworkFactory.newClient("localhost:2181", new ExponentialBackoffRetry(1000, 3));
        client.start();
        serviceDiscovery = ServiceDiscoveryBuilder.builder(ExampleService.class).client(client).basePath("/discovery").build();
        serviceDiscovery.start();

        ServiceProvider<ExampleService> provider = providers.get("babyduncan");
        if (provider == null) {
            provider = serviceDiscovery.serviceProviderBuilder().serviceName("babyduncan").providerStrategy(new RandomStrategy<ExampleService>()).build();
            providers.put("babyduncan", provider);
            provider.start();
        }

        for (int i = 0; i < 100; i++) {

            ServiceInstance<ExampleService> instance = provider.getInstance();
            if (instance == null) {
                System.err.println("No instances named: babyduncan");
            } else {
                System.out.println("\t" + instance.getAddress() + ":" + instance.getPort() + ": " + instance.buildUriSpec());
            }

            Thread.sleep(2000);

        }
    }