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_withIpV4Address_returnsIpV4NetworkEndpoint() {
    assertThat(NetworkEndpointUtils.forIp("1.2.3.4"))
        .isEqualTo(
            NetworkEndpoint.newBuilder()
                .setType(NetworkEndpoint.Type.IP)
                .setIpAddress(
                    IpAddress.newBuilder()
                        .setAddressFamily(AddressFamily.IPV4)
                        .setAddress("1.2.3.4"))
                .build());
  }