public Set<InetSocketAddress> getServers(String zookeeperInstance, String serviceName) {
    try (CuratorFramework zkClient = connectToZookeeper(zookeeperInstance)) {
      ZookeeperServiceReader reader = new ZookeeperServiceReader();

      Set<InetSocketAddress> servers =
          reader
              .nodePaths(zkClient, serviceName)
              .stream()
              .map(nodePath -> toInetAdrress(nodePath, reader, zkClient))
              .filter(address -> address != null)
              .collect(Collectors.toSet());

      return servers;
    } catch (Exception e) {
      logger.error("Rethrowing error ", e);
      throw new RuntimeException(e);
    }
  }
 private InetSocketAddress toInetAdrress(
     String nodePath, ZookeeperServiceReader reader, CuratorFramework zkClient) {
   try {
     byte[] data = zkClient.getData().forPath(nodePath);
     if (data == null) {
       // clustered service member went away, but path still exists
       return null;
     }
     return reader.deserialize(data);
   } catch (Exception e) {
     logger.error("Rethrowing exception ", e);
     throw new RuntimeException(e);
   }
 }