Home / Function/ testExpire() — netty Function Reference

testExpire() — netty Function Reference

Architecture documentation for the testExpire() function in DefaultAuthoritativeDnsServerCacheTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  317bea78_5cbe_99cd_b512_036f12435822["testExpire()"]
  4a9246bd_af88_49ac_ddb5_b152cf30ca29["DefaultAuthoritativeDnsServerCacheTest"]
  317bea78_5cbe_99cd_b512_036f12435822 -->|defined in| 4a9246bd_af88_49ac_ddb5_b152cf30ca29
  style 317bea78_5cbe_99cd_b512_036f12435822 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

resolver-dns/src/test/java/io/netty/resolver/dns/DefaultAuthoritativeDnsServerCacheTest.java lines 36–67

    @Test
    public void testExpire() throws Throwable {
        InetSocketAddress resolved1 = new InetSocketAddress(
                InetAddress.getByAddress("ns1", new byte[] { 10, 0, 0, 1 }), 53);
        InetSocketAddress resolved2 = new InetSocketAddress(
                InetAddress.getByAddress("ns2", new byte[] { 10, 0, 0, 2 }), 53);
        EventLoopGroup group = new MultiThreadIoEventLoopGroup(1, LocalIoHandler.newFactory());

        try {
            EventLoop loop = group.next();
            final DefaultAuthoritativeDnsServerCache cache = new DefaultAuthoritativeDnsServerCache();
            cache.cache("netty.io", resolved1, 1, loop);
            cache.cache("netty.io", resolved2, 10000, loop);

            Throwable error = loop.schedule(new Callable<Throwable>() {
                @Override
                public Throwable call() {
                    try {
                        assertNull(cache.get("netty.io"));
                        return null;
                    } catch (Throwable cause) {
                        return cause;
                    }
                }
            }, 1, TimeUnit.SECONDS).get();
            if (error != null) {
                throw error;
            }
        } finally {
            group.shutdownGracefully();
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does testExpire() do?
testExpire() is a function in the netty codebase, defined in resolver-dns/src/test/java/io/netty/resolver/dns/DefaultAuthoritativeDnsServerCacheTest.java.
Where is testExpire() defined?
testExpire() is defined in resolver-dns/src/test/java/io/netty/resolver/dns/DefaultAuthoritativeDnsServerCacheTest.java at line 36.

Analyze Your Own Codebase

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

Try Supermodel Free