code: public static String getAddressForUrl(String address, boolean resolveForIp) {
          if (address == null) {
              return null;
          }
  
          // drop schema
          int pos = address.indexOf("://");
          if (pos > 0) {
              address = address.substring(pos + 3);
          }
  
          // drop user authentication information
          pos = address.indexOf('@');
          if (pos > 0) {
              address = address.substring(pos + 1);
          }
  
          // drop trailing parts: port number, query parameters, path, fragment
          for (int i = 0; i < address.length(); ++i) {
              char c = address.charAt(i);
              if ((c == ':') || (c == '?') || (c == '/') || (c == '#')) {
                  return address.substring(0, i);
              }
          }
          return address;
      }
docs: Extract host name from the given endpoint URI.
  @see <a href="http://tools.ietf.org/html/rfc3986#section-3">RFC 3986, Section 3</a>
  
  @param address
  endpoint URI or bare IP address.
  @param resolveForIp
  dummy.
  @return
  host name contained in the URI.