code: public static InetAddress forUriString(String hostAddr) {
      InetAddress addr = forUriStringNoThrow(hostAddr);
      if (addr == null) {
        throw formatIllegalArgumentException("Not a valid URI IP literal: '%s'", hostAddr);
      }
  
      return addr;
    }
docs: Returns an InetAddress representing the literal IPv4 or IPv6 host portion of a URL, encoded in
  the format specified by RFC 3986 section 3.2.2.
  
  <p>This function is similar to {@link InetAddresses#forString(String)}, however, it requires
  that IPv6 addresses are surrounded by square brackets.
  
  <p>This function is the inverse of {@link InetAddresses#toUriString(java.net.InetAddress)}.
  
  @param hostAddr A RFC 3986 section 3.2.2 encoded IPv4 or IPv6 address
  @return an InetAddress representing the address in {@code hostAddr}
  @throws IllegalArgumentException if {@code hostAddr} is not a valid IPv4 address, or IPv6
  address surrounded by square brackets