use of org.minidns.source.async.AsyncNetworkDataSource in project minidns by MiniDNS.
the class AsyncApiTest method simpleAsyncApiTest.
public static void simpleAsyncApiTest() throws IOException {
DNSClient client = new DNSClient();
client.setDataSource(new AsyncNetworkDataSource());
client.getDataSource().setTimeout(60 * 60 * 1000);
MiniDnsFuture<DNSMessage, IOException> future = client.queryAsync("example.com", Record.TYPE.NS);
DNSMessage response = future.getOrThrow();
assertEquals(RESPONSE_CODE.NO_ERROR, response.responseCode);
}
use of org.minidns.source.async.AsyncNetworkDataSource in project minidns by MiniDNS.
the class AsyncApiTest method tcpAsyncApiTest.
public static void tcpAsyncApiTest() throws IOException {
DNSDataSource dataSource = new AsyncNetworkDataSource();
dataSource.setTimeout(60 * 60 * 1000);
dataSource.setUdpPayloadSize(256);
dataSource.setQueryMode(QueryMode.tcp);
DNSClient client = new DNSClient();
client.setDataSource(dataSource);
client.setAskForDnssec(true);
MiniDnsFuture<DNSMessage, IOException> future = client.queryAsync("google.com", Record.TYPE.AAAA);
DNSMessage response = future.getOrThrow();
assertEquals(RESPONSE_CODE.NO_ERROR, response.responseCode);
}
Aggregations