Example usage for io.netty.handler.codec.dns DnsResponse recordAt

List of usage examples for io.netty.handler.codec.dns DnsResponse recordAt

Introduction

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

Prototype

<T extends DnsRecord> T recordAt(DnsSection section);

Source Link

Document

Returns the first record in the specified section of this DNS message.

Usage

From source file:io.vertx.core.dns.impl.fix.DnsQueryContext.java

License:Apache License

void finish(AddressedEnvelope<? extends DnsResponse, InetSocketAddress> envelope) {
    final DnsResponse res = envelope.content();
    if (res.count(DnsSection.QUESTION) != 1) {
        logger.warn("Received a DNS response with invalid number of questions: {}", envelope);
        return;/*from   w  w w  .ja  v  a  2 s.c  o  m*/
    }

    if (!question().equals(res.recordAt(DnsSection.QUESTION))) {
        logger.warn("Received a mismatching DNS response: {}", envelope);
        return;
    }

    setSuccess(envelope);
}