use of io.vertx.core.dns.DnsClient in project vert.x by eclipse.
the class DNSExamples method example6.
public void example6(Vertx vertx) {
DnsClient client = vertx.createDnsClient(53, "10.0.0.1");
client.resolveAAAA("vertx.io", ar -> {
if (ar.succeeded()) {
List<String> records = ar.result();
for (String record : records) {
System.out.println(record);
}
} else {
System.out.println("Failed to resolve entry" + ar.cause());
}
});
}
use of io.vertx.core.dns.DnsClient in project vert.x by eclipse.
the class DNSExamples method example7.
public void example7(Vertx vertx) {
DnsClient client = vertx.createDnsClient(53, "10.0.0.1");
client.resolveCNAME("vertx.io", ar -> {
if (ar.succeeded()) {
List<String> records = ar.result();
for (String record : records) {
System.out.println(record);
}
} else {
System.out.println("Failed to resolve entry" + ar.cause());
}
});
}
use of io.vertx.core.dns.DnsClient in project vert.x by eclipse.
the class DNSExamples method example15.
public void example15(Vertx vertx) {
DnsClient client = vertx.createDnsClient(53, "10.0.0.1");
client.reverseLookup("10.0.0.1", ar -> {
if (ar.succeeded()) {
String record = ar.result();
System.out.println(record);
} else {
System.out.println("Failed to resolve entry" + ar.cause());
}
});
}
use of io.vertx.core.dns.DnsClient in project vert.x by eclipse.
the class DNSTest method testLookupNonExisting.
@Test
public void testLookupNonExisting() throws Exception {
DnsClient dns = prepareDns(FakeDNSServer.testLookupNonExisting());
dns.lookup("gfegjegjf.sg1", ar -> {
DnsException cause = (DnsException) ar.cause();
assertEquals(DnsResponseCode.NXDOMAIN, cause.code());
testComplete();
});
await();
dnsServer.stop();
}
use of io.vertx.core.dns.DnsClient in project vert.x by eclipse.
the class DNSTest method testResolveNS.
@Test
public void testResolveNS() throws Exception {
final String ns = "ns.vertx.io";
DnsClient dns = prepareDns(FakeDNSServer.testResolveNS(ns));
dns.resolveNS("vertx.io", ar -> {
List<String> result = ar.result();
assertNotNull(result);
assertFalse(result.isEmpty());
assertEquals(1, result.size());
assertEquals(ns, result.get(0));
testComplete();
});
await();
dnsServer.stop();
}
Aggregations