1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package io.netty.testsuite.svm.client;
17
18 import io.netty.channel.nio.NioEventLoopGroup;
19 import io.netty.channel.socket.nio.NioDatagramChannel;
20 import io.netty.resolver.AddressResolver;
21 import io.netty.resolver.dns.DnsAddressResolverGroup;
22 import io.netty.resolver.dns.DnsServerAddressStreamProviders;
23 import io.netty.util.concurrent.DefaultThreadFactory;
24
25 import java.net.InetSocketAddress;
26
27
28
29
30 public final class DnsNativeClient {
31
32
33
34 private DnsNativeClient() {
35 }
36
37 public static void main(String[] args) throws Exception {
38 NioEventLoopGroup group = new NioEventLoopGroup(1, new DefaultThreadFactory("netty"));
39
40 DnsAddressResolverGroup resolverGroup = new DnsAddressResolverGroup(NioDatagramChannel.class,
41 DnsServerAddressStreamProviders.platformDefault());
42 AddressResolver<InetSocketAddress> resolver = resolverGroup.getResolver(group.next());
43 System.out.println(resolver);
44
45 resolver.close();
46 group.shutdownGracefully().get();
47 }
48 }