public static String unresolvedHostAndPortToNormalizedString(String host, int port) {
        Preconditions.checkArgument(isValidHostPort(port), "Port is not within the valid range,");
        return unresolvedHostToNormalizedString(host) + ":" + port;
    }
@Test
    void testFormatAddress() {

        assertThat(NetUtils.unresolvedHostAndPortToNormalizedString(null, 42))
                .isEqualTo("127.0.0.1" + ":" + 42);

        // IPv4
        assertThat(NetUtils.unresolvedHostAndPortToNormalizedString("1.2.3.4", 42))
                .isEqualTo("1.2.3.4" + ":" + 42);

        // IPv6
        assertThat(
                        NetUtils.unresolvedHostAndPortToNormalizedString(
                                "2001:0db8:85a3:0000:0000:8a2e:0370:7334", 42))
                .isEqualTo("[2001:db8:85a3::8a2e:370:7334]:" + 42);

        // [IPv6]
        assertThat(
                        NetUtils.unresolvedHostAndPortToNormalizedString(
                                "[2001:0db8:85a3:0000:0000:8a2e:0370:7334]", 42))
                .isEqualTo("[2001:db8:85a3::8a2e:370:7334]:" + 42);

        // Hostnames
        assertThat(NetUtils.unresolvedHostAndPortToNormalizedString("somerandomhostname", 99))
                .isEqualTo("somerandomhostname" + ":" + 99);

        // Whitespace
        assertThat(NetUtils.unresolvedHostAndPortToNormalizedString("  somerandomhostname  ", 99))
                .isEqualTo("somerandomhostname" + ":" + 99);

        // Illegal hostnames
        assertThatThrownBy(
                        () -> NetUtils.unresolvedHostAndPortToNormalizedString("illegalhost.", 42))
                .isInstanceOf(IllegalConfigurationException.class);
        assertThatThrownBy(
                        () ->
                                NetUtils.unresolvedHostAndPortToNormalizedString(
                                        "illegalhost:fasf", 42))
                .isInstanceOf(IllegalConfigurationException.class);

        // Illegal port ranges
        assertThatThrownBy(() -> NetUtils.unresolvedHostAndPortToNormalizedString("1.2.3.4", -1))
                .isInstanceOf(Exception.class);

        // lower case conversion of hostnames
        assertThat(NetUtils.unresolvedHostAndPortToNormalizedString("CamelCaseHostName", 99))
                .isEqualTo("camelcasehostname" + ":" + 99);
    }