List of usage examples for io.netty.handler.codec.dns DatagramDnsQueryEncoder DatagramDnsQueryEncoder
public DatagramDnsQueryEncoder()
From source file:io.vertx.core.dns.impl.DnsClientImpl.java
License:Open Source License
public DnsClientImpl(VertxInternal vertx, int port, String host) { ContextImpl creatingContext = vertx.getContext(); if (creatingContext != null && creatingContext.isMultiThreadedWorkerContext()) { throw new IllegalStateException("Cannot use DnsClient in a multi-threaded worker verticle"); }/*from ww w . j a va2s. c o m*/ this.dnsServer = new InetSocketAddress(host, port); actualCtx = vertx.getOrCreateContext(); bootstrap = new Bootstrap(); bootstrap.group(actualCtx.nettyEventLoop()); bootstrap.channel(NioDatagramChannel.class); bootstrap.option(ChannelOption.ALLOCATOR, PartialPooledByteBufAllocator.INSTANCE); bootstrap.handler(new ChannelInitializer<DatagramChannel>() { @Override protected void initChannel(DatagramChannel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); pipeline.addLast(new DatagramDnsQueryEncoder()); pipeline.addLast(new DatagramDnsResponseDecoder()); } }); }