use of io.vertx.core.dns.DnsClientOptions in project vert.x by eclipse.
the class DNSTest method testTimeout.
@Test
public void testTimeout() throws Exception {
DnsClient dns = vertx.createDnsClient(new DnsClientOptions().setHost("localhost").setPort(10000).setQueryTimeout(5000));
dns.lookup("vertx.io", onFailure(result -> {
assertEquals(VertxException.class, result.getClass());
assertEquals("DNS query timeout for vertx.io.", result.getMessage());
((DnsClientImpl) dns).inProgressQueries(num -> {
assertEquals(0, (int) num);
testComplete();
});
}));
await();
}
use of io.vertx.core.dns.DnsClientOptions in project vert.x by eclipse.
the class DNSTest method testRecursionDesired.
@Test
public void testRecursionDesired() throws Exception {
final String ip = "10.0.0.1";
dnsServer.testResolveA(ip);
DnsClient dns = prepareDns(new DnsClientOptions().setRecursionDesired(true));
dns.resolveA("vertx.io", onSuccess(result -> {
assertFalse(result.isEmpty());
assertEquals(1, result.size());
assertEquals(ip, result.get(0));
DnsMessage msg = dnsServer.pollMessage();
assertTrue(msg.isRecursionDesired());
((DnsClientImpl) dns).inProgressQueries(num -> {
assertEquals(0, (int) num);
testComplete();
});
}));
await();
}
use of io.vertx.core.dns.DnsClientOptions in project vert.x by eclipse.
the class DNSExamples method example1__.
public void example1__(Vertx vertx) {
DnsClient client1 = vertx.createDnsClient();
// Just the same but with a different query timeout
DnsClient client2 = vertx.createDnsClient(new DnsClientOptions().setQueryTimeout(10000));
}
Aggregations