Search in sources :

Example 6 with DnsClientImpl

use of io.vertx.core.dns.impl.DnsClientImpl 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();
}
Also used : DnsClientOptions(io.vertx.core.dns.DnsClientOptions) VertxException(io.vertx.core.VertxException) DnsException(io.vertx.core.dns.DnsException) DnsMessage(org.apache.directory.server.dns.messages.DnsMessage) DnsClientImpl(io.vertx.core.dns.impl.DnsClientImpl) TestLoggerFactory(io.vertx.test.netty.TestLoggerFactory) Vertx(io.vertx.core.Vertx) DnsClientOptions(io.vertx.core.dns.DnsClientOptions) VertxOptions(io.vertx.core.VertxOptions) Test(org.junit.Test) TestUtils.assertNullPointerException(io.vertx.test.core.TestUtils.assertNullPointerException) InetSocketAddress(java.net.InetSocketAddress) Function(java.util.function.Function) VertxTestBase(io.vertx.test.core.VertxTestBase) SrvRecord(io.vertx.core.dns.SrvRecord) DnsClient(io.vertx.core.dns.DnsClient) List(java.util.List) TestUtils(io.vertx.test.core.TestUtils) DeploymentOptions(io.vertx.core.DeploymentOptions) AbstractVerticle(io.vertx.core.AbstractVerticle) DnsResponseCode(io.vertx.core.dns.DnsResponseCode) MxRecord(io.vertx.core.dns.MxRecord) FakeDNSServer(io.vertx.test.fakedns.FakeDNSServer) TestUtils.assertIllegalStateException(io.vertx.test.core.TestUtils.assertIllegalStateException) DnsClient(io.vertx.core.dns.DnsClient) DnsMessage(org.apache.directory.server.dns.messages.DnsMessage) Test(org.junit.Test)

Aggregations

DnsClientOptions (io.vertx.core.dns.DnsClientOptions)6 DnsClientImpl (io.vertx.core.dns.impl.DnsClientImpl)6 InetSocketAddress (java.net.InetSocketAddress)6 AbstractVerticle (io.vertx.core.AbstractVerticle)5 DeploymentOptions (io.vertx.core.DeploymentOptions)5 Vertx (io.vertx.core.Vertx)5 VertxException (io.vertx.core.VertxException)5 VertxOptions (io.vertx.core.VertxOptions)5 DnsClient (io.vertx.core.dns.DnsClient)5 DnsException (io.vertx.core.dns.DnsException)5 DnsResponseCode (io.vertx.core.dns.DnsResponseCode)5 MxRecord (io.vertx.core.dns.MxRecord)5 SrvRecord (io.vertx.core.dns.SrvRecord)5 TestUtils (io.vertx.test.core.TestUtils)5 TestUtils.assertIllegalStateException (io.vertx.test.core.TestUtils.assertIllegalStateException)5 TestUtils.assertNullPointerException (io.vertx.test.core.TestUtils.assertNullPointerException)5 VertxTestBase (io.vertx.test.core.VertxTestBase)5 FakeDNSServer (io.vertx.test.fakedns.FakeDNSServer)5 TestLoggerFactory (io.vertx.test.netty.TestLoggerFactory)5 List (java.util.List)5