List of usage examples for io.netty.resolver.dns DnsNameResolverBuilder decodeIdn
boolean decodeIdn
To view the source code for io.netty.resolver.dns DnsNameResolverBuilder decodeIdn.
Click Source Link
From source file:chat.viska.xmpp.Connection.java
License:Apache License
private static Single<List<DnsRecord>> lookupDnsUsingNetty(final String query, final DnsRecordType type, @Nullable final Iterable<String> dns) { final NioEventLoopGroup threadPool = new NioEventLoopGroup(); final DnsNameResolverBuilder builder = new DnsNameResolverBuilder(threadPool.next()); builder.channelFactory(new ReflectiveChannelFactory<>(NioDatagramChannel.class)); builder.decodeIdn(true); if (dns != null) { builder.searchDomains(dns);//from w w w. j a v a 2 s.co m } return Single.fromFuture(builder.build().query(new DefaultDnsQuestion(query, type))) .map(AddressedEnvelope::content).map(message -> { final int recordsSize = message.count(DnsSection.ANSWER); final List<DnsRecord> records = new ArrayList<>(recordsSize); for (int it = 0; it < recordsSize; ++it) { records.add(message.recordAt(DnsSection.ANSWER, it)); } return records; }).doFinally(threadPool::shutdownGracefully); }