code: public static HostAndPort getValidHostAndPortFromString(String endpoint) {
          HostAndPort hostAndPort = HostAndPort.fromString(endpoint);
  
          String host = hostAndPort.getHostText();
          checkState(host != null && !host.isEmpty(), "invalid host");
  
          int Port = hostAndPort.getPort();
          checkState(Port > 0, "invalid port");
  
          return hostAndPort;
      }
docs: Convert an address string of the form <em>"host:port"</em> into a {@link HostAndPort} instance.
  
  @param endpoint non-empty address string
  @return a valid {@code HostAndPort} instance. Callers can use
  {@link com.google.common.net.HostAndPort#getHostText()} and
  {@link com.google.common.net.HostAndPort#getPort()} to get the
  host and port components of {@code endpoint}
  
  @throws IllegalStateException if {@code endpoint} cannot be parsed