use of org.minidns.record.OPT in project minidns by MiniDNS.
the class DNSMessageTest method testMessageSelfOptRecordReconstructione.
@SuppressWarnings("unchecked")
@Test
public void testMessageSelfOptRecordReconstructione() throws Exception {
DNSMessage.Builder m = DNSMessage.builder();
m.addAdditionalResourceRecord(record("www.example.com", a("127.0.0.1")));
m.getEdnsBuilder().setUdpPayloadSize(512).setDnssecOk();
DNSMessage message = new DNSMessage(m.build().toArray());
assertEquals(2, message.additionalSection.size());
assertCsEquals("www.example.com", message.additionalSection.get(0).name);
assertEquals(TYPE.A, message.additionalSection.get(0).type);
assertCsEquals("127.0.0.1", message.additionalSection.get(0).payloadData.toString());
assertCsEquals("EDNS: version: 0, flags: do; udp: 512", new EDNS((Record<OPT>) message.additionalSection.get(1)).toString());
}
use of org.minidns.record.OPT in project minidns by MiniDNS.
the class DNSMessage method getEdns.
public EDNS getEdns() {
if (edns != null)
return edns;
Record<OPT> optRecord = getOptPseudoRecord();
if (optRecord == null)
return null;
edns = new EDNS(optRecord);
return edns;
}
Aggregations