Home / Function/ testInflightQueries() — netty Function Reference

testInflightQueries() — netty Function Reference

Architecture documentation for the testInflightQueries() function in DnsNameResolverTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  c48e36e3_04fa_a2e3_63a2_59889f01bb6f["testInflightQueries()"]
  b6215f36_0afe_a284_a3fd_3999e90a8e97["DnsNameResolverTest"]
  c48e36e3_04fa_a2e3_63a2_59889f01bb6f -->|defined in| b6215f36_0afe_a284_a3fd_3999e90a8e97
  df4510f5_88a8_20fd_2366_a4c543cdf3b8["resolve()"]
  c48e36e3_04fa_a2e3_63a2_59889f01bb6f -->|calls| df4510f5_88a8_20fd_2366_a4c543cdf3b8
  f68a278a_d1e5_7598_a2d3_c261c81029bc["get()"]
  c48e36e3_04fa_a2e3_63a2_59889f01bb6f -->|calls| f68a278a_d1e5_7598_a2d3_c261c81029bc
  style c48e36e3_04fa_a2e3_63a2_59889f01bb6f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

resolver-dns/src/test/java/io/netty/resolver/dns/DnsNameResolverTest.java lines 4164–4215

    @ParameterizedTest
    @EnumSource(DnsNameResolverChannelStrategy.class)
    public void testInflightQueries(DnsNameResolverChannelStrategy strategy) throws Exception {
        final String addressString = "10.0.0.1";
        final AtomicInteger called = new AtomicInteger();
        final CountDownLatch latch = new CountDownLatch(1);
        final TestDnsServer dnsServer2 = new TestDnsServer(new RecordStore() {
            @Override
            public Set<ResourceRecord> getRecords(QuestionRecord question) {
                called.incrementAndGet();
                try {
                    latch.await();
                    ResourceRecordModifier rm = new ResourceRecordModifier();
                    rm.setDnsClass(RecordClass.IN);
                    rm.setDnsName(question.getDomainName());
                    rm.setDnsTtl(100);

                    rm.setDnsType(question.getRecordType());
                    rm.put(DnsAttribute.IP_ADDRESS, addressString);
                    return Collections.singleton(rm.getEntry());
                } catch (InterruptedException e) {
                    throw new IllegalStateException(e);
                }
            }
        });
        dnsServer2.start();

        DnsNameResolver resolver = newResolver(strategy)
                .nameServerProvider(new SingletonDnsServerAddressStreamProvider(dnsServer2.localAddress()))
                .resolvedAddressTypes(ResolvedAddressTypes.IPV4_ONLY)
                .consolidateCacheSize(2)
                .build();

        byte[] bytes =  NetUtil.createByteArrayFromIpAddressString(addressString);
        InetAddress inetAddress = InetAddress.getByAddress(bytes);
        try {
            Future<InetAddress> f = resolver.resolve("netty.io");
            Future<InetAddress> f2 = resolver.resolve("netty.io");
            assertFalse(f.isDone());
            assertFalse(f2.isDone());

            // Now unblock so we receive the response back for our query.
            latch.countDown();

            assertEquals(inetAddress, f.sync().getNow());
            assertEquals(inetAddress, f2.sync().getNow());
        } finally {
            resolver.close();
            dnsServer2.stop();
            assertEquals(1, called.get());
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does testInflightQueries() do?
testInflightQueries() is a function in the netty codebase, defined in resolver-dns/src/test/java/io/netty/resolver/dns/DnsNameResolverTest.java.
Where is testInflightQueries() defined?
testInflightQueries() is defined in resolver-dns/src/test/java/io/netty/resolver/dns/DnsNameResolverTest.java at line 4164.
What does testInflightQueries() call?
testInflightQueries() calls 2 function(s): get, resolve.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free