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.EventLoopGroup;
19 import io.netty.channel.MultiThreadIoEventLoopGroup;
20 import io.netty.channel.nio.NioIoHandler;
21 import io.netty.channel.socket.nio.NioDatagramChannel;
22 import io.netty.resolver.AddressResolver;
23 import io.netty.resolver.dns.DnsAddressResolverGroup;
24 import io.netty.resolver.dns.DnsServerAddressStreamProviders;
25 import io.netty.util.concurrent.DefaultThreadFactory;
26
27 import java.net.InetSocketAddress;
28
29
30
31
32 public final class DnsNativeClient {
33
34
35
36 private DnsNativeClient() {
37 }
38
39 public static void main(String[] args) throws Exception {
40 EventLoopGroup group = new MultiThreadIoEventLoopGroup(
41 1, new DefaultThreadFactory("netty"), NioIoHandler.newFactory());
42
43 DnsAddressResolverGroup resolverGroup = new DnsAddressResolverGroup(NioDatagramChannel.class,
44 DnsServerAddressStreamProviders.platformDefault());
45 AddressResolver<InetSocketAddress> resolver = resolverGroup.getResolver(group.next());
46 System.out.println(resolver);
47
48 resolver.close();
49 group.shutdownGracefully().get();
50 }
51 }