List of usage examples for io.netty.resolver ResolvedAddressTypes IPV6_ONLY
ResolvedAddressTypes IPV6_ONLY
To view the source code for io.netty.resolver ResolvedAddressTypes IPV6_ONLY.
Click Source Link
From source file:com.linecorp.armeria.client.endpoint.dns.DnsAddressEndpointGroupTest.java
License:Apache License
@Test public void ipV6Only() throws Exception { try (TestDnsServer server = new TestDnsServer(ImmutableMap.of(new DefaultDnsQuestion("bar.com.", AAAA), new DefaultDnsResponse(0).addRecord(ANSWER, newAddressRecord("bar.com.", "::1")) .addRecord(ANSWER, newAddressRecord("bar.com.", "::1234:5678:90ab")) .addRecord(ANSWER, newAddressRecord("bar.com.", "2404:6800:4004:806::2013"))))) { try (DnsAddressEndpointGroup group = new DnsAddressEndpointGroupBuilder("bar.com").port(8080) .serverAddresses(server.addr()).resolvedAddressTypes(ResolvedAddressTypes.IPV6_ONLY).build()) { assertThat(group.awaitInitialEndpoints()).containsExactly( Endpoint.of("bar.com", 8080).withIpAddr("2404:6800:4004:806::2013"), Endpoint.of("bar.com", 8080).withIpAddr("::1"), Endpoint.of("bar.com", 8080).withIpAddr("::1234:5678:90ab")); }/* w ww . j a v a 2 s .co m*/ } }
From source file:com.linecorp.armeria.client.endpoint.dns.DnsAddressEndpointGroupTest.java
License:Apache License
@Test public void ipV4MappedOrCompatibleAddresses() throws Exception { try (TestDnsServer server = new TestDnsServer(ImmutableMap.of(new DefaultDnsQuestion("bar.com.", AAAA), new DefaultDnsResponse(0).addRecord(ANSWER, newCompatibleAddressRecord("bar.com.", "1.1.1.1")) .addRecord(ANSWER, newCompatibleAddressRecord("bar.com.", "1.1.1.2")) .addRecord(ANSWER, newMappedAddressRecord("bar.com.", "1.1.1.1")) .addRecord(ANSWER, newMappedAddressRecord("bar.com.", "1.1.1.3"))))) { try (DnsAddressEndpointGroup group = new DnsAddressEndpointGroupBuilder("bar.com").port(8080) .serverAddresses(server.addr()).resolvedAddressTypes(ResolvedAddressTypes.IPV6_ONLY).build()) { assertThat(group.awaitInitialEndpoints()).containsExactly( Endpoint.of("bar.com", 8080).withIpAddr("1.1.1.1"), Endpoint.of("bar.com", 8080).withIpAddr("1.1.1.2"), Endpoint.of("bar.com", 8080).withIpAddr("1.1.1.3")); }/* w ww .j a v a 2 s.co m*/ } }