Example usage for io.vertx.core.dns DnsException code

List of usage examples for io.vertx.core.dns DnsException code

Introduction

In this page you can find the example usage for io.vertx.core.dns DnsException code.

Prototype

DnsResponseCode code

To view the source code for io.vertx.core.dns DnsException code.

Click Source Link

Usage

From source file:docoverride.dns.Examples.java

License:Open Source License

public void example16(Vertx vertx) {
    DnsClient client = vertx.createDnsClient(53, "10.0.0.1");
    client.lookup("nonexisting.vert.xio", ar -> {
        if (ar.succeeded()) {
            String record = ar.result();
            System.out.println(record);
        } else {//  w  w  w.j  a  v  a2  s . c om
            Throwable cause = ar.cause();
            if (cause instanceof DnsException) {
                DnsException exception = (DnsException) cause;
                DnsResponseCode code = exception.code();
                // ...
            } else {
                System.out.println("Failed to resolve entry" + ar.cause());
            }
        }
    });
}