@Test public void testServerFailed() throws Exception { m_request.m_reqID = 24212; try { m_request.verifyResponse(servFailResponseBytes, servFailResponseBytes.length); } catch (IOException ioe) { assertEquals("Server Failure (2)", ioe.getMessage()); return; } throw new Exception("Should have caught an IOException for ServFail!"); }
public void verifyResponse(byte[] data, int length) throws IOException { DNSInputStream dnsIn = new DNSInputStream(data, 0, length); int id = dnsIn.readShort(); if (id != m_reqID) throw new IOException("ID in received packet (" + id + ") does not match ID from request (" + m_reqID + ")"); int flags = dnsIn.readShort(); decodeFlags(flags); }
DNSAddressRequest { public void verifyResponse(byte[] data, int length) throws IOException { DNSInputStream dnsIn = new DNSInputStream(data, 0, length); int id = dnsIn.readShort(); if (id != m_reqID) throw new IOException("ID in received packet (" + id + ") does not match ID from request (" + m_reqID + ")"); int flags = dnsIn.readShort(); decodeFlags(flags); } }
DNSAddressRequest { public void verifyResponse(byte[] data, int length) throws IOException { DNSInputStream dnsIn = new DNSInputStream(data, 0, length); int id = dnsIn.readShort(); if (id != m_reqID) throw new IOException("ID in received packet (" + id + ") does not match ID from request (" + m_reqID + ")"); int flags = dnsIn.readShort(); decodeFlags(flags); } DNSAddressRequest(String host); }
DNSAddressRequest { public void verifyResponse(byte[] data, int length) throws IOException { DNSInputStream dnsIn = new DNSInputStream(data, 0, length); int id = dnsIn.readShort(); if (id != m_reqID) throw new IOException("ID in received packet (" + id + ") does not match ID from request (" + m_reqID + ")"); int flags = dnsIn.readShort(); decodeFlags(flags); } DNSAddressRequest(String host); byte[] buildRequest(); void receiveResponse(byte[] data, int length); void verifyResponse(byte[] data, int length); List<DNSAddressRR> getAnswers(); int getRequestID(); String getHost(); boolean isTruncated(); boolean isRecursive(); boolean isAuthoritative(); static String codeName(int code); List<Integer> getFatalResponseCodes(); void setFatalResponseCodes(List<Integer> codes); }
DNSAddressRequest { public void verifyResponse(byte[] data, int length) throws IOException { DNSInputStream dnsIn = new DNSInputStream(data, 0, length); int id = dnsIn.readShort(); if (id != m_reqID) throw new IOException("ID in received packet (" + id + ") does not match ID from request (" + m_reqID + ")"); int flags = dnsIn.readShort(); decodeFlags(flags); } DNSAddressRequest(String host); byte[] buildRequest(); void receiveResponse(byte[] data, int length); void verifyResponse(byte[] data, int length); List<DNSAddressRR> getAnswers(); int getRequestID(); String getHost(); boolean isTruncated(); boolean isRecursive(); boolean isAuthoritative(); static String codeName(int code); List<Integer> getFatalResponseCodes(); void setFatalResponseCodes(List<Integer> codes); static final int CLASS_IN; static final int TYPE_ADDR; static final int SHIFT_QUERY; static final int SHIFT_OPCODE; static final int SHIFT_AUTHORITATIVE; static final int SHIFT_TRUNCATED; static final int SHIFT_RECURSE_PLEASE; static final int SHIFT_RECURSE_AVAILABLE; static final int SHIFT_RESERVED; static final int SHIFT_RESPONSE_CODE; static final int OPCODE_QUERY; public String m_reqHost; public int m_reqID; public boolean m_authoritative; public boolean m_truncated; public boolean m_recursive; public List<DNSAddressRR> m_answers; }