public static NetworkEndpoint forIpHostnameAndPort(String ipAddress, String hostname, int port) {
    checkArgument(
        0 <= port && port <= MAX_PORT_NUMBER,
        "Port out of range. Expected [0, %s], actual %s.",
        MAX_PORT_NUMBER,
        port);

    return forIpAndHostname(ipAddress, hostname).toBuilder()
        .setType(NetworkEndpoint.Type.IP_HOSTNAME_PORT)
        .setPort(Port.newBuilder().setPortNumber(port))
        .build();
  }
@Test
  public void forIpHostnameAndPort_returnsIpHostnameAndPortNetworkEndpoint() {
    assertThat(NetworkEndpointUtils.forIpHostnameAndPort("1.2.3.4", "host.com", 8888))
        .isEqualTo(
            NetworkEndpoint.newBuilder()
                .setType(NetworkEndpoint.Type.IP_HOSTNAME_PORT)
                .setIpAddress(
                    IpAddress.newBuilder()
                        .setAddressFamily(AddressFamily.IPV4)
                        .setAddress("1.2.3.4"))
                .setHostname(Hostname.newBuilder().setName("host.com"))
                .setPort(Port.newBuilder().setPortNumber(8888))
                .build());
  }