Search in sources :

Example 1 with Builder

use of org.minidns.dnsmessage.DNSMessage.Builder in project minidns by MiniDNS.

the class NSIDTest method testNsidLRoot.

@IntegrationTest
public static NSID testNsidLRoot() {
    DNSClient client = new DNSClient(null) {

        @Override
        protected Builder newQuestion(Builder message) {
            message.getEdnsBuilder().addEdnsOption(NSID.REQUEST);
            return super.newQuestion(message);
        }
    };
    DNSMessage response = null;
    Question q = new Question("de", TYPE.NS);
    for (InetAddress lRoot : IterativeDNSClient.getRootServer('l')) {
        try {
            response = client.query(q, lRoot);
        } catch (IOException e) {
            continue;
        }
        break;
    }
    NSID nsid = response.getEdns().getEdnsOption(OptionCode.NSID);
    assertNotNull(nsid);
    return nsid;
}
Also used : IterativeDNSClient(org.minidns.iterative.IterativeDNSClient) DNSClient(org.minidns.DNSClient) NSID(org.minidns.edns.NSID) Builder(org.minidns.dnsmessage.DNSMessage.Builder) Question(org.minidns.dnsmessage.Question) IOException(java.io.IOException) InetAddress(java.net.InetAddress) DNSMessage(org.minidns.dnsmessage.DNSMessage)

Aggregations

IOException (java.io.IOException)1 InetAddress (java.net.InetAddress)1 DNSClient (org.minidns.DNSClient)1 DNSMessage (org.minidns.dnsmessage.DNSMessage)1 Builder (org.minidns.dnsmessage.DNSMessage.Builder)1 Question (org.minidns.dnsmessage.Question)1 NSID (org.minidns.edns.NSID)1 IterativeDNSClient (org.minidns.iterative.IterativeDNSClient)1