コード例 #1
0
 /** Test of decode method, of class DNSJavaDecoder. */
 @Test
 public void testDecode() {
   System.out.println("decode");
   String resp =
       "567f818000010007000000000667726f75707306676f6f676c6503636f6d0000010001c00c000500010000463a000b0667726f757073016cc013c02f000100010000011a00044a7d2765c02f000100010000011a00044a7d2771c02f000100010000011a00044a7d278ac02f000100010000011a00044a7d2766c02f000100010000011a00044a7d2764c02f000100010000011a00044a7d278b";
   byte[] buf = BinaryTCPClientImpl.hexStringToByteArray(resp);
   DNSJavaDecoder instance = new DNSJavaDecoder();
   String expResult = "NOERROR";
   String result = new String(instance.decode(buf));
   System.out.println(result);
   assertTrue(result.contains(expResult));
 }
コード例 #2
0
 @Test
 public void testDecode_tcp() {
   System.out.println("decode");
   // 0038 byte prefix must not be passed to parser
   String resp =
       "bcd581800001000200000000036e6e6d0272750000010001c00c00010001000027540004596fbd95c00c00010001000027540004596fbd94";
   byte[] buf = BinaryTCPClientImpl.hexStringToByteArray(resp);
   DNSJavaDecoder instance = new DNSJavaDecoder();
   String expResult = "NOERROR";
   String result = new String(instance.decode(buf));
   System.out.println(result);
   assertTrue(result.contains(expResult));
 }