/** Test of getRecord method, of class DNSJavaDecoder. */
 @Test
 public void testGetRecord() {
   System.out.println("getRecord");
   String recstr = ". A IN";
   DNSJavaDecoder instance = new DNSJavaDecoder();
   Record result = instance.getRecord(recstr);
   assertTrue(result.toString().endsWith("A"));
 }
 /** Test of getMessageBytes method, of class DNSJavaDecoder. */
 @Test
 public void testGetMessageBytes() {
   System.out.println("getMessageBytes");
   String data = ". A IN";
   DNSJavaDecoder instance = new DNSJavaDecoder();
   int expResult = 17;
   byte[] result = instance.getMessageBytes(data);
   assertEquals(expResult, result.length);
 }
 /** 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));
 }
 @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));
 }
 @Test
 public void testEncode_withFlagsMac() throws UnsupportedEncodingException {
   System.out.println("encode f");
   // stackowerflow.com
   String data = "stackowerflow.com. A IN\n\r7\n\r-7";
   DNSJavaDecoder instance = new DNSJavaDecoder();
   ByteBuffer result = instance.encode(data);
   String exp = "3f3c000000010000000000000d737461636b6f776572666c6f7703636f6d0000010001";
   String res =
       JOrphanUtils.baToHexString(JMeterPluginsUtils.byteBufferToString(result).getBytes("cp866"));
   System.out.println(exp);
   System.out.println(res);
   assertEquals(exp.substring(8), res.substring(res.length() - exp.length() + 8));
 }