@SuppressWarnings("unchecked") @Test public void basicIterativeTest() throws IOException { IterativeDnsClient client = new IterativeDnsClient(new LruCache(0)); applyZones(client, rootZone( record("com", ns("ns.com")), record("ns.com", a("1.1.1.1")) ), zone("com", "ns.com", "1.1.1.1", record("example.com", ns("ns.example.com")), record("ns.example.com", a("1.1.1.2")) ), zone("example.com", "ns.example.com", "1.1.1.2", record("www.example.com", a("1.1.1.3")) ) ); DnsQueryResult result = client.query("www.example.com", TYPE.A); DnsMessage message = result.response; List<Record<? extends Data>> answers = message.answerSection; assertEquals(1, answers.size()); assertEquals(TYPE.A, answers.get(0).type); assertArrayEquals(new byte[] {1, 1, 1, 3}, ((A) answers.get(0).payloadData).getIp()); }
@Override protected DnsQueryResult query(DnsMessage.Builder queryBuilder) throws IOException { DnsMessage q = queryBuilder.build(); ResolutionState resolutionState = new ResolutionState(this); DnsQueryResult result = queryRecursive(resolutionState, q); return result; }
IterativeDnsClient extends AbstractDnsClient { @Override protected DnsQueryResult query(DnsMessage.Builder queryBuilder) throws IOException { DnsMessage q = queryBuilder.build(); ResolutionState resolutionState = new ResolutionState(this); DnsQueryResult result = queryRecursive(resolutionState, q); return result; } }
IterativeDnsClient extends AbstractDnsClient { @Override protected DnsQueryResult query(DnsMessage.Builder queryBuilder) throws IOException { DnsMessage q = queryBuilder.build(); ResolutionState resolutionState = new ResolutionState(this); DnsQueryResult result = queryRecursive(resolutionState, q); return result; } IterativeDnsClient();  IterativeDnsClient(DnsCache cache); }
IterativeDnsClient extends AbstractDnsClient { @Override protected DnsQueryResult query(DnsMessage.Builder queryBuilder) throws IOException { DnsMessage q = queryBuilder.build(); ResolutionState resolutionState = new ResolutionState(this); DnsQueryResult result = queryRecursive(resolutionState, q); return result; } IterativeDnsClient();  IterativeDnsClient(DnsCache cache); static List<InetAddress> getRootServer(char rootServerId); static List<InetAddress> getRootServer(char rootServerId, IpVersionSetting setting); }
IterativeDnsClient extends AbstractDnsClient { @Override protected DnsQueryResult query(DnsMessage.Builder queryBuilder) throws IOException { DnsMessage q = queryBuilder.build(); ResolutionState resolutionState = new ResolutionState(this); DnsQueryResult result = queryRecursive(resolutionState, q); return result; } IterativeDnsClient();  IterativeDnsClient(DnsCache cache); static List<InetAddress> getRootServer(char rootServerId); static List<InetAddress> getRootServer(char rootServerId, IpVersionSetting setting);  }