guava/src/com/google/common/net/HostAndPort.java
public static HostAndPort fromHost(String host) {
    HostAndPort parsedHost = fromString(host);
    checkArgument(!parsedHost.hasPort(), "Host has a port: %s", host);
    return parsedHost;
  }
public static HostAndPort fromHost(String host) {
    HostAndPort parsedHost = fromString(host);
    checkArgument(!parsedHost.hasPort(), "Host has a port: %s", host);
    return parsedHost;
  }
Build a HostAndPort instance from a host only.

<p>Note: Non-bracketed IPv6 literals are allowed. Use {@link #requireBracketsForIPv6()} to
prohibit these.

@param host the host-only string to parse. Must not contain a port number.
@return if parsing was successful, a populated HostAndPort object.
@throws IllegalArgumentException if {@code host} contains a port number.
@since 17.0