public static NetworkEndpoint forIpAndPort(String ipAddress, int port) {
    checkArgument(InetAddresses.isInetAddress(ipAddress), "'%s' is not an IP address.", ipAddress);
    checkArgument(
        0 <= port && port <= MAX_PORT_NUMBER,
        "Port out of range. Expected [0, %s], actual %s.",
        MAX_PORT_NUMBER,
        port);

    return forIp(ipAddress).toBuilder()
        .setType(NetworkEndpoint.Type.IP_PORT)
        .setPort(Port.newBuilder().setPortNumber(port))
        .build();
  }
@Test
  public void forIpAndPort_withInvalidIp_throwsIllegalArgumentException() {
    assertThrows(
        IllegalArgumentException.class, () -> NetworkEndpointUtils.forIpAndPort("abc", 8888));
  }