Source:
public DnsClientImpl(VertxInternal vertx, DnsClientOptions options) { Objects.requireNonNull(options, "no null options accepted"); Objects.requireNonNull(options.getHost(), "no null host accepted"); if (options.getPort() < 1) { throw new IllegalArgumentException("DNS client port " + options.getPort() + " must be > 0"); } if (options.getQueryTimeout() < 0) { throw new IllegalArgumentException("DNS client timeout " + options.getQueryTimeout() + " must be > 0"); } this.options = new DnsClientOptions(options); ContextInternal creatingContext = vertx.getContext(); if (creatingContext != null && creatingContext.isMultiThreadedWorkerContext()) { throw new IllegalStateException("Cannot use DnsClient in a multi-threaded worker verticle"); } this.dnsServer = new InetSocketAddress(options.getHost(), options.getPort()); this.vertx = vertx; Transport transport = vertx.transport(); actualCtx = vertx.getOrCreateContext(); channel = transport.datagramChannel(InternetProtocolFamily.IPv4); channel.config().setOption(ChannelOption.DATAGRAM_CHANNEL_ACTIVE_ON_REGISTRATION, true); channel.config().setMaxMessagesPerRead(1); channel.config().setAllocator(PartialPooledByteBufAllocator.INSTANCE); actualCtx.nettyEventLoop().register(channel); if (options.getLogActivity()) { channel.pipeline().addLast("logging", new LoggingHandler()); } channel.pipeline().addLast(new DatagramDnsQueryEncoder()); channel.pipeline().addLast(new DatagramDnsResponseDecoder()); channel.pipeline().addLast(new SimpleChannelInboundHandler<DnsResponse>() { @Override protected void channelRead0(ChannelHandlerContext ctx, DnsResponse msg) throws Exception { int id = msg.id(); Query query = inProgressMap.get(id); if (query != null) { query.handle(msg); } } }); }

Target:
public DnsClientImpl(VertxInternal vertx, DnsClientOptions options) { Objects.requireNonNull(options, "no null options accepted"); Objects.requireNonNull(options.getHost(), "no null host accepted"); this.options = new DnsClientOptions(options); ContextInternal creatingContext = vertx.getContext(); if (creatingContext != null && creatingContext.isMultiThreadedWorkerContext()) { throw new IllegalStateException("Cannot use DnsClient in a multi-threaded worker verticle"); } this.dnsServer = new InetSocketAddress(options.getHost(), options.getPort()); this.vertx = vertx; Transport transport = vertx.transport(); actualCtx = vertx.getOrCreateContext(); channel = transport.datagramChannel(InternetProtocolFamily.IPv4); channel.config().setOption(ChannelOption.DATAGRAM_CHANNEL_ACTIVE_ON_REGISTRATION, true); channel.config().setMaxMessagesPerRead(1); channel.config().setAllocator(PartialPooledByteBufAllocator.INSTANCE); actualCtx.nettyEventLoop().register(channel); if (options.getLogActivity()) { channel.pipeline().addLast("logging", new LoggingHandler()); } channel.pipeline().addLast(new DatagramDnsQueryEncoder()); channel.pipeline().addLast(new DatagramDnsResponseDecoder()); channel.pipeline().addLast(new SimpleChannelInboundHandler<DnsResponse>() { @Override protected void channelRead0(ChannelHandlerContext ctx, DnsResponse msg) throws Exception { int id = msg.id(); Query query = inProgressMap.get(id); if (query != null) { query.handle(msg); } } }); }