public static NetworkEndpoint forIp(String ipAddress) {
    checkArgument(InetAddresses.isInetAddress(ipAddress), "'%s' is not an IP address.", ipAddress);

    return NetworkEndpoint.newBuilder()
        .setType(NetworkEndpoint.Type.IP)
        .setIpAddress(
            IpAddress.newBuilder()
                .setAddressFamily(ipAddressFamily(ipAddress))
                .setAddress(ipAddress))
        .build();
  }
@Test
  public void forIp_withInvalidIp_throwsIllegalArgumentException() {
    assertThrows(IllegalArgumentException.class, () -> NetworkEndpointUtils.forIp("abc"));
  }