use of io.vertx.core.dns.MxRecord in project vert.x by eclipse.
the class DNSTest method testResolveMX.
@Test
public void testResolveMX() throws Exception {
final String mxRecord = "mail.vertx.io";
final int prio = 10;
DnsClient dns = prepareDns(FakeDNSServer.testResolveMX(prio, mxRecord));
dns.resolveMX("vertx.io", ar -> {
List<MxRecord> result = ar.result();
assertNotNull(result);
assertFalse(result.isEmpty());
assertEquals(1, result.size());
MxRecord record = result.get(0);
assertEquals(prio, record.priority());
assertEquals(record.name(), mxRecord);
testComplete();
});
await();
dnsServer.stop();
}
use of io.vertx.core.dns.MxRecord in project vert.x by eclipse.
the class DNSExamples method example8.
public void example8(Vertx vertx) {
DnsClient client = vertx.createDnsClient(53, "9.9.9.9");
client.resolveMX("vertx.io", ar -> {
if (ar.succeeded()) {
List<MxRecord> records = ar.result();
for (MxRecord record : records) {
System.out.println(record);
}
} else {
System.out.println("Failed to resolve entry" + ar.cause());
}
});
}
use of io.vertx.core.dns.MxRecord in project vert.x by eclipse.
the class DNSTest method testResolveMX.
@Test
public void testResolveMX() throws Exception {
final String mxRecord = "mail.vertx.io";
final int prio = 10;
dnsServer.testResolveMX(prio, mxRecord);
DnsClient dns = prepareDns();
dns.resolveMX("vertx.io", onSuccess(result -> {
assertFalse(result.isEmpty());
assertEquals(1, result.size());
MxRecord record = result.get(0);
assertEquals(prio, record.priority());
assertEquals(record.name(), mxRecord);
testComplete();
}));
await();
}
Aggregations