Example usage for io.netty.handler.codec.dns DatagramDnsQueryDecoder DatagramDnsQueryDecoder

List of usage examples for io.netty.handler.codec.dns DatagramDnsQueryDecoder DatagramDnsQueryDecoder

Introduction

In this page you can find the example usage for io.netty.handler.codec.dns DatagramDnsQueryDecoder DatagramDnsQueryDecoder.

Prototype

public DatagramDnsQueryDecoder() 

Source Link

Document

Creates a new decoder with DnsRecordDecoder#DEFAULT the default record decoder .

Usage

From source file:com.linecorp.armeria.client.endpoint.dns.TestDnsServer.java

License:Apache License

TestDnsServer(Map<DnsQuestion, DnsResponse> responses) {
    this.responses = ImmutableMap.copyOf(responses);

    final Bootstrap b = new Bootstrap();
    b.channel(TransportType.datagramChannelType(CommonPools.workerGroup()));
    b.group(CommonPools.workerGroup());//from   w  ww .j a v  a  2s  . c o  m
    b.handler(new ChannelInitializer() {
        @Override
        protected void initChannel(Channel ch) throws Exception {
            final ChannelPipeline p = ch.pipeline();
            p.addLast(new DatagramDnsQueryDecoder());
            p.addLast(new DatagramDnsResponseEncoder());
            p.addLast(new DnsServerHandler());
        }
    });

    channel = b.bind(NetUtil.LOCALHOST, 0).syncUninterruptibly().channel();
}