code: public static InetSocketAddress createSocketAddr(String target,
        int defaultPort) {
      // Format [IPv6 Address]:Port
      int colonIndex = target.indexOf(':');
      if (colonIndex < 0 && defaultPort == -1) {
        throw new RuntimeException("Not a host:port pair: " + target);
      }
      String hostname;
      int port = -1;
      if (!target.contains("/")) {
        target = "hdfs://" + target;
      }
      // a new uri
      URI addr = new Path(target).toUri();
      hostname = addr.getHost();
      port = addr.getPort();
      
  
      if (port == -1) {
        port = defaultPort;
      }
  
      if (getStaticResolution(hostname) != null) {
        hostname = getStaticResolution(hostname);
      }
  
      return InetSocketAddressFactory.createWithResolveRetry(hostname, port);
    }
docs: Util method to build socket addr from either:
  <host>
  <host>:<post>
  <fs>://<host>:<port>/<path>