Program: 4651
Project: 4651
Buggy source:
/** 
 * Runs the legacy unit test that was formerly in QueryReply.
 */
public void testLegacy() throws Exception {
  byte[] ip={(byte)0xFF,(byte)0,(byte)0,(byte)0x1};
  long u4=0x00000000FFFFFFFFl;
  byte[] guid=new byte[16];
  guid[0]=(byte)1;
  guid[15]=(byte)0xFF;
  Response[] responses=new Response[0];
  QueryReply qr=new QueryReply(guid,(byte)5,0xF3F1,ip,1,responses,guid,false);
  assertEquals(1,qr.getSpeed());
  assertEquals(Integer.toHexString(qr.getPort()),0xF3F1,qr.getPort());
  assertEquals(qr.getResults().hasNext(),false);
  responses=new Response[2];
  responses[0]=new Response(11,22,"String_Node_Str");
  responses[1]=new Response(0x2FF2,0xF11F,"String_Node_Str");
  qr=new QueryReply(guid,(byte)5,0xFFFF,ip,u4,responses,guid,false);
  assertEquals("String_Node_Str",qr.getIP());
  assertEquals(0xFFFF,qr.getPort());
  assertEquals(u4,qr.getSpeed());
  assertTrue(Arrays.equals(qr.getClientGUID(),guid));
  Iterator iter=qr.getResults();
  Response r1=(Response)iter.next();
  assertEquals(r1,responses[0]);
  Response r2=(Response)iter.next();
  assertEquals(r2,responses[1]);
  assertFalse(iter.hasNext());
  byte[] payload=new byte[11 + 11 + 16];
  payload[0]=1;
  payload[11 + 8]=(byte)65;
  qr=new QueryReply(new byte[16],(byte)5,(byte)0,payload);
  iter=qr.getResults();
  Response response=(Response)iter.next();
  assertEquals("String_Node_Str",response.getName());
  assertFalse(iter.hasNext());
  try {
    qr.getVendor();
    fail("String_Node_Str");
  }
 catch (  BadPacketException e) {
  }
  try {
    qr.getNeedsPush();
    fail("String_Node_Str");
  }
 catch (  BadPacketException e) {
  }
  payload=new byte[11 + 11 + 15];
  payload[0]=1;
  payload[11 + 8]=(byte)65;
  qr=new QueryReply(new byte[16],(byte)5,(byte)0,payload);
  try {
    iter=qr.getResults();
    fail("String_Node_Str");
  }
 catch (  BadPacketException e) {
  }
  try {
    qr.getVendor();
    fail("String_Node_Str");
  }
 catch (  BadPacketException e) {
  }
  payload=new byte[11 + 11 + (4 + 1 + 4+ 5)+ 16];
  payload[0]=1;
  payload[11 + 8]=(byte)65;
  payload[11 + 11 + 0]=(byte)76;
  payload[11 + 11 + 1]=(byte)76;
  payload[11 + 11 + 2]=(byte)77;
  payload[11 + 11 + 3]=(byte)69;
  payload[11 + 11 + 4+ 0]=(byte)QueryReply.COMMON_PAYLOAD_LEN;
  payload[11 + 11 + 4+ 1+ 2]=(byte)5;
  payload[11 + 11 + 4+ 1+ 3]=(byte)0;
  payload[11 + 11 + 4+ 1+ 4]=(byte)'S';
  payload[11 + 11 + 4+ 1+ 4+ 1]=(byte)'U';
  payload[11 + 11 + 4+ 1+ 4+ 2]=(byte)'S';
  payload[11 + 11 + 4+ 1+ 4+ 3]=(byte)'H';
  payload[11 + 11 + 4+ 1+ 4+ 4]=(byte)0;
  qr=new QueryReply(new byte[16],(byte)5,(byte)0,payload);
  try {
    iter=qr.getResults();
    Response r=(Response)iter.next();
    assertEquals("String_Node_Str",1,r.getNameBytesSize());
    assertEquals("String_Node_Str",0,r.getMetaBytesSize());
    byte[] name=r.getNameBytes();
    assertEquals("String_Node_Str",'A',name[0]);
    assertEquals("String_Node_Str","String_Node_Str",r.getName());
    assertEquals("String_Node_Str","String_Node_Str",(new String(qr.getXMLBytes())));
  }
 catch (  BadPacketException e) {
    fail("String_Node_Str",e);
  }
  payload=new byte[11 + 11 + (4 + 1 + 4+ 4)+ 16];
  payload[0]=1;
  payload[11 + 8]=(byte)65;
  payload[11 + 11 + 0]=(byte)76;
  payload[11 + 11 + 1]=(byte)105;
  payload[11 + 11 + 2]=(byte)77;
  payload[11 + 11 + 3]=(byte)69;
  payload[11 + 11 + 4+ 0]=(byte)QueryReply.COMMON_PAYLOAD_LEN;
  payload[11 + 11 + 4+ 1]=(byte)0xB1;
  payload[11 + 11 + 4+ 1+ 2]=(byte)4;
  payload[11 + 11 + 4+ 1+ 3]=(byte)0;
  qr=new QueryReply(new byte[16],(byte)5,(byte)0,payload);
  String vendor=qr.getVendor();
  assertEquals(vendor,"String_Node_Str",vendor);
  vendor=qr.getVendor();
  assertEquals(vendor,"String_Node_Str",vendor);
  assertTrue(qr.getNeedsPush());
  payload=new byte[11 + 11 + (4 + 1 + 4+ 20000)+ 16];
  payload[0]=1;
  payload[11 + 8]=(byte)65;
  payload[11 + 11 + 0]=(byte)76;
  payload[11 + 11 + 1]=(byte)76;
  payload[11 + 11 + 2]=(byte)77;
  payload[11 + 11 + 3]=(byte)69;
  payload[11 + 11 + 4+ 0]=(byte)QueryReply.COMMON_PAYLOAD_LEN;
  payload[11 + 11 + 4+ 1]=(byte)0xF0;
  payload[11 + 11 + 4+ 1+ 2]=(byte)32;
  payload[11 + 11 + 4+ 1+ 3]=(byte)78;
  for (int i=0; i < 20000; i++)   payload[11 + 11 + 4+ 1+ 4+ i]='a';
  qr=new QueryReply(new byte[16],(byte)5,(byte)0,payload);
  vendor=qr.getVendor();
  assertEquals(vendor,"String_Node_Str",vendor);
  vendor=qr.getVendor();
  assertEquals(vendor,"String_Node_Str",vendor);
  assertFalse(qr.getNeedsPush());
  try {
    qr.getSupportsChat();
    fail("String_Node_Str");
  }
 catch (  BadPacketException e) {
  }
  payload=new byte[11 + 11 + (4 + 1 + 2)+ 16];
  payload[0]=1;
  payload[11 + 8]=(byte)65;
  payload[11 + 11 + 4+ 1+ 0]=(byte)1;
  qr=new QueryReply(new byte[16],(byte)5,(byte)0,payload);
  try {
    qr.getNeedsPush();
    fail("String_Node_Str");
  }
 catch (  BadPacketException e) {
  }
  try {
    qr.getVendor();
    fail("String_Node_Str");
  }
 catch (  BadPacketException e) {
  }
  payload=new byte[11 + 11 + (4 + 2 + 0)+ 16];
  payload[0]=1;
  payload[11 + 8]=(byte)65;
  payload[11 + 11 + 0]=(byte)76;
  payload[11 + 11 + 1]=(byte)105;
  payload[11 + 11 + 2]=(byte)77;
  payload[11 + 11 + 3]=(byte)69;
  payload[11 + 11 + 4+ 0]=(byte)2;
  qr=new QueryReply(new byte[16],(byte)5,(byte)0,payload);
  qr.getResults();
  try {
    qr.getVendor();
    fail("String_Node_Str");
  }
 catch (  BadPacketException e) {
  }
  payload=new byte[11 + 11 + (4 + 1 + 4+ 1)+ 16];
  payload[0]=1;
  payload[11 + 8]=(byte)65;
  payload[11 + 11 + 0]=(byte)76;
  payload[11 + 11 + 1]=(byte)105;
  payload[11 + 11 + 2]=(byte)77;
  payload[11 + 11 + 3]=(byte)69;
  payload[11 + 11 + 4+ 0]=(byte)QueryReply.COMMON_PAYLOAD_LEN;
  payload[11 + 11 + 4+ 1]=(byte)0x0;
  payload[11 + 11 + 4+ 1+ 1]=(byte)0x0;
  payload[11 + 11 + 4+ 1+ 2]=(byte)1;
  qr=new QueryReply(new byte[16],(byte)5,(byte)0,payload);
  vendor=qr.getVendor();
  assertEquals("String_Node_Str","String_Node_Str",vendor);
  assertTrue(!qr.getNeedsPush());
  try {
    qr.getIsBusy();
    fail("String_Node_Str");
  }
 catch (  BadPacketException e) {
  }
  try {
    qr.getHadSuccessfulUpload();
    fail("String_Node_Str");
  }
 catch (  BadPacketException e) {
  }
  try {
    qr.getIsMeasuredSpeed();
    fail("String_Node_Str");
  }
 catch (  BadPacketException e) {
  }
  payload=new byte[11 + 11 + (4 + 1 + 4+ 1+ 1)+ 16];
  payload[0]=1;
  payload[11 + 8]=(byte)65;
  payload[11 + 11 + 0]=(byte)76;
  payload[11 + 11 + 1]=(byte)73;
  payload[11 + 11 + 2]=(byte)77;
  payload[11 + 11 + 3]=(byte)69;
  payload[11 + 11 + 4]=(byte)QueryReply.COMMON_PAYLOAD_LEN;
  payload[11 + 11 + 4+ 1]=(byte)0x1d;
  payload[11 + 11 + 4+ 1+ 1]=(byte)0x1c;
  payload[11 + 11 + 4+ 1+ 2]=(byte)1;
  payload[11 + 11 + 4+ 1+ 4]=(byte)0x1;
  qr=new QueryReply(new byte[16],(byte)5,(byte)0,payload);
  vendor=qr.getVendor();
  assertEquals(vendor,"String_Node_Str",vendor);
  assertTrue(qr.getNeedsPush());
  assertTrue(qr.getNeedsPush());
  assertTrue(qr.getIsBusy());
  assertTrue(qr.getIsBusy());
  assertTrue(qr.getIsMeasuredSpeed());
  assertTrue(qr.getIsMeasuredSpeed());
  assertTrue(qr.getHadSuccessfulUpload());
  assertTrue(qr.getHadSuccessfulUpload());
  assertTrue(qr.getSupportsChat());
  payload=new byte[11 + 11 + (4 + 1 + 4+ 1)+ 16];
  payload[0]=1;
  payload[11 + 8]=(byte)65;
  payload[11 + 11 + 0]=(byte)76;
  payload[11 + 11 + 1]=(byte)105;
  payload[11 + 11 + 2]=(byte)77;
  payload[11 + 11 + 3]=(byte)69;
  payload[11 + 11 + 4]=(byte)QueryReply.COMMON_PAYLOAD_LEN;
  payload[11 + 11 + 4+ 1]=(byte)0x1c;
  payload[11 + 11 + 4+ 1+ 1]=(byte)0x0;
  payload[11 + 11 + 4+ 1+ 2]=(byte)1;
  qr=new QueryReply(new byte[16],(byte)5,(byte)0,payload);
  vendor=qr.getVendor();
  assertEquals(vendor,"String_Node_Str",vendor);
  assertFalse(qr.getNeedsPush());
  assertFalse(qr.getIsBusy());
  assertFalse(qr.getIsMeasuredSpeed());
  assertFalse(qr.getHadSuccessfulUpload());
  try {
    qr.getSupportsChat();
    fail("String_Node_Str");
  }
 catch (  BadPacketException e) {
  }
  responses=new Response[2];
  responses[0]=new Response(11,22,"String_Node_Str");
  responses[1]=new Response(0x2FF2,0xF11F,"String_Node_Str");
  qr=new QueryReply(guid,(byte)5,0xFFFF,ip,u4,responses,guid,false,true,true,false,true,false);
  assertEquals("String_Node_Str",qr.getIP());
  assertEquals(0xFFFF,qr.getPort());
  assertEquals(u4,qr.getSpeed());
  assertTrue(Arrays.equals(qr.getClientGUID(),guid));
  iter=qr.getResults();
  r1=(Response)iter.next();
  assertEquals(r1,responses[0]);
  r2=(Response)iter.next();
  assertEquals(r2,responses[1]);
  assertFalse(iter.hasNext());
  assertEquals("String_Node_Str",qr.getVendor());
  assertFalse(qr.getNeedsPush());
  assertTrue(qr.getIsBusy());
  assertTrue(qr.getHadSuccessfulUpload());
  assertFalse(qr.getIsMeasuredSpeed());
  assertTrue(qr.getSupportsChat());
  assertTrue(qr.getSupportsBrowseHost());
  assertTrue(!qr.isReplyToMulticastQuery());
  responses=new Response[2];
  responses[0]=new Response(11,22,"String_Node_Str");
  responses[1]=new Response(0x2FF2,0xF11F,"String_Node_Str");
  qr=new QueryReply(guid,(byte)5,0xFFFF,ip,u4,responses,guid,true,false,false,true,false,false);
  assertEquals("String_Node_Str",qr.getVendor());
  assertTrue(qr.getNeedsPush());
  assertFalse(qr.getIsBusy());
  assertFalse(qr.getHadSuccessfulUpload());
  assertTrue(qr.getIsMeasuredSpeed());
  assertFalse(qr.getSupportsChat());
  assertTrue(qr.getSupportsBrowseHost());
  assertTrue(!qr.isReplyToMulticastQuery());
  ByteArrayOutputStream out=new ByteArrayOutputStream();
  qr.write(out);
  byte[] bytes=out.toByteArray();
  int ggepLen=_ggepUtil.getQRGGEP(true,false).length;
  assertEquals((23 + 11 + 16) + (8 + 10 + 2) + (8 + 14 + 2)+ (4 + 1 + QueryReply.COMMON_PAYLOAD_LEN+ 1+ 1)+ ggepLen,bytes.length);
  assertEquals(0x3d,bytes[bytes.length - 16 - 6- ggepLen]);
  assertEquals(0x31,bytes[bytes.length - 16 - 5- ggepLen]);
  qr=(QueryReply)Message.read(new ByteArrayInputStream(bytes));
  assertEquals("String_Node_Str",qr.getVendor());
  assertTrue(qr.getNeedsPush());
  assertFalse(qr.getIsBusy());
  assertFalse(qr.getHadSuccessfulUpload());
  assertTrue(qr.getIsMeasuredSpeed());
  assertFalse(qr.getSupportsChat());
  assertTrue(qr.getSupportsBrowseHost());
  assertTrue(!qr.isReplyToMulticastQuery());
  responses=new Response[2];
  responses[0]=new Response(11,22,"String_Node_Str");
  responses[1]=new Response(0x2FF2,0xF11F,"String_Node_Str");
  qr=new QueryReply(guid,(byte)5,0xFFFF,ip,u4,responses,guid,true,false,false,true,false,true);
  assertEquals("String_Node_Str",qr.getVendor());
  assertTrue(qr.getNeedsPush());
  assertFalse(qr.getIsBusy());
  assertFalse(qr.getHadSuccessfulUpload());
  assertTrue(qr.getIsMeasuredSpeed());
  assertFalse(qr.getSupportsChat());
  assertTrue(qr.getSupportsBrowseHost());
  assertTrue(qr.isReplyToMulticastQuery());
  out=new ByteArrayOutputStream();
  qr.write(out);
  bytes=out.toByteArray();
  ggepLen=_ggepUtil.getQRGGEP(true,true).length;
  assertEquals(bytes.length,(23 + 11 + 16) + (8 + 10 + 2) + (8 + 14 + 2)+ (4 + 1 + QueryReply.COMMON_PAYLOAD_LEN+ 1+ 1)+ ggepLen);
  assertEquals(bytes[bytes.length - 16 - 6- ggepLen],0x3d);
  assertEquals(bytes[bytes.length - 16 - 5- ggepLen],0x31);
  qr=(QueryReply)Message.read(new ByteArrayInputStream(bytes));
  assertEquals("String_Node_Str",qr.getVendor());
  assertTrue(qr.getNeedsPush());
  assertFalse(qr.getIsBusy());
  assertFalse(qr.getHadSuccessfulUpload());
  assertTrue(qr.getIsMeasuredSpeed());
  assertFalse(qr.getSupportsChat());
  assertTrue(qr.getSupportsBrowseHost());
  assertTrue(qr.isReplyToMulticastQuery());
  responses=new Response[2];
  responses[0]=new Response(11,22,"String_Node_Str");
  responses[1]=new Response(0x2FF2,0xF11F,"String_Node_Str");
  qr=new QueryReply(guid,(byte)5,0xFFFF,ip,u4,responses,guid,false);
  try {
    qr.getVendor();
    fail("String_Node_Str");
  }
 catch (  BadPacketException e) {
  }
  try {
    qr.getNeedsPush();
    fail("String_Node_Str");
  }
 catch (  BadPacketException e) {
  }
  try {
    qr.getIsBusy();
    fail("String_Node_Str");
  }
 catch (  BadPacketException e) {
  }
  try {
    qr.getHadSuccessfulUpload();
    fail("String_Node_Str");
  }
 catch (  BadPacketException e) {
  }
  try {
    qr.getIsMeasuredSpeed();
    fail("String_Node_Str");
  }
 catch (  BadPacketException e) {
  }
}

Fixed version (ground truth):
/** 
 * Runs the legacy unit test that was formerly in QueryReply.
 */
public void testLegacy() throws Exception {
  byte[] ip={(byte)0xFF,(byte)0,(byte)0,(byte)0x1};
  long u4=0x00000000FFFFFFFFl;
  byte[] guid=new byte[16];
  guid[0]=(byte)1;
  guid[15]=(byte)0xFF;
  Response[] responses=new Response[0];
  QueryReply qr=new QueryReply(guid,(byte)5,0xF3F1,ip,1,responses,guid,false);
  assertEquals(1,qr.getSpeed());
  assertEquals(Integer.toHexString(qr.getPort()),0xF3F1,qr.getPort());
  assertEquals(qr.getResults().hasNext(),false);
  responses=new Response[2];
  responses[0]=new Response(11,22,"String_Node_Str");
  responses[1]=new Response(0x2FF2,0xF11F,"String_Node_Str");
  qr=new QueryReply(guid,(byte)5,0xFFFF,ip,u4,responses,guid,false);
  assertEquals("String_Node_Str",qr.getIP());
  assertEquals(0xFFFF,qr.getPort());
  assertEquals(u4,qr.getSpeed());
  assertTrue(Arrays.equals(qr.getClientGUID(),guid));
  Iterator iter=qr.getResults();
  Response r1=(Response)iter.next();
  assertEquals(r1,responses[0]);
  Response r2=(Response)iter.next();
  assertEquals(r2,responses[1]);
  assertFalse(iter.hasNext());
  byte[] payload=new byte[11 + 11 + 16];
  payload[0]=1;
  payload[11 + 8]=(byte)65;
  qr=new QueryReply(new byte[16],(byte)5,(byte)0,payload);
  iter=qr.getResults();
  Response response=(Response)iter.next();
  assertEquals("String_Node_Str",response.getName());
  assertFalse(iter.hasNext());
  try {
    qr.getVendor();
    fail("String_Node_Str");
  }
 catch (  BadPacketException e) {
  }
  try {
    qr.getNeedsPush();
    fail("String_Node_Str");
  }
 catch (  BadPacketException e) {
  }
  payload=new byte[11 + 11 + 15];
  payload[0]=1;
  payload[11 + 8]=(byte)65;
  qr=new QueryReply(new byte[16],(byte)5,(byte)0,payload);
  try {
    iter=qr.getResults();
    fail("String_Node_Str");
  }
 catch (  BadPacketException e) {
  }
  try {
    qr.getVendor();
    fail("String_Node_Str");
  }
 catch (  BadPacketException e) {
  }
  payload=new byte[11 + 11 + (4 + 1 + 4+ 5)+ 16];
  payload[0]=1;
  payload[11 + 8]=(byte)65;
  payload[11 + 11 + 0]=(byte)76;
  payload[11 + 11 + 1]=(byte)76;
  payload[11 + 11 + 2]=(byte)77;
  payload[11 + 11 + 3]=(byte)69;
  payload[11 + 11 + 4+ 0]=(byte)QueryReply.COMMON_PAYLOAD_LEN;
  payload[11 + 11 + 4+ 1+ 2]=(byte)5;
  payload[11 + 11 + 4+ 1+ 3]=(byte)0;
  payload[11 + 11 + 4+ 1+ 4]=(byte)'S';
  payload[11 + 11 + 4+ 1+ 4+ 1]=(byte)'U';
  payload[11 + 11 + 4+ 1+ 4+ 2]=(byte)'S';
  payload[11 + 11 + 4+ 1+ 4+ 3]=(byte)'H';
  payload[11 + 11 + 4+ 1+ 4+ 4]=(byte)0;
  qr=new QueryReply(new byte[16],(byte)5,(byte)0,payload);
  try {
    iter=qr.getResults();
    Response r=(Response)iter.next();
    assertEquals("String_Node_Str",1,r.getNameBytesSize());
    assertEquals("String_Node_Str",0,r.getMetaBytesSize());
    byte[] name=r.getNameBytes();
    assertEquals("String_Node_Str",'A',name[0]);
    assertEquals("String_Node_Str","String_Node_Str",r.getName());
    assertEquals("String_Node_Str","String_Node_Str",(new String(qr.getXMLBytes())));
  }
 catch (  BadPacketException e) {
    fail("String_Node_Str",e);
  }
  payload=new byte[11 + 11 + (4 + 1 + 4+ 4)+ 16];
  payload[0]=1;
  payload[11 + 8]=(byte)65;
  payload[11 + 11 + 0]=(byte)76;
  payload[11 + 11 + 1]=(byte)105;
  payload[11 + 11 + 2]=(byte)77;
  payload[11 + 11 + 3]=(byte)69;
  payload[11 + 11 + 4+ 0]=(byte)QueryReply.COMMON_PAYLOAD_LEN;
  payload[11 + 11 + 4+ 1]=(byte)0xB1;
  payload[11 + 11 + 4+ 1+ 2]=(byte)4;
  payload[11 + 11 + 4+ 1+ 3]=(byte)0;
  qr=new QueryReply(new byte[16],(byte)5,(byte)0,payload);
  String vendor=qr.getVendor();
  assertEquals(vendor,"String_Node_Str",vendor);
  vendor=qr.getVendor();
  assertEquals(vendor,"String_Node_Str",vendor);
  assertTrue(qr.getNeedsPush());
  payload=new byte[11 + 11 + (4 + 1 + 4+ 20000)+ 16];
  payload[0]=1;
  payload[11 + 8]=(byte)65;
  payload[11 + 11 + 0]=(byte)76;
  payload[11 + 11 + 1]=(byte)76;
  payload[11 + 11 + 2]=(byte)77;
  payload[11 + 11 + 3]=(byte)69;
  payload[11 + 11 + 4+ 0]=(byte)QueryReply.COMMON_PAYLOAD_LEN;
  payload[11 + 11 + 4+ 1]=(byte)0xF0;
  payload[11 + 11 + 4+ 1+ 2]=(byte)32;
  payload[11 + 11 + 4+ 1+ 3]=(byte)78;
  for (int i=0; i < 20000; i++)   payload[11 + 11 + 4+ 1+ 4+ i]='a';
  qr=new QueryReply(new byte[16],(byte)5,(byte)0,payload);
  vendor=qr.getVendor();
  assertEquals(vendor,"String_Node_Str",vendor);
  vendor=qr.getVendor();
  assertEquals(vendor,"String_Node_Str",vendor);
  assertFalse(qr.getNeedsPush());
  try {
    qr.getSupportsChat();
    fail("String_Node_Str");
  }
 catch (  BadPacketException e) {
  }
  payload=new byte[11 + 11 + (4 + 1 + 2)+ 16];
  payload[0]=1;
  payload[11 + 8]=(byte)65;
  payload[11 + 11 + 4+ 1+ 0]=(byte)1;
  qr=new QueryReply(new byte[16],(byte)5,(byte)0,payload);
  try {
    qr.getNeedsPush();
    fail("String_Node_Str");
  }
 catch (  BadPacketException e) {
  }
  try {
    qr.getVendor();
    fail("String_Node_Str");
  }
 catch (  BadPacketException e) {
  }
  payload=new byte[11 + 11 + (4 + 2 + 0)+ 16];
  payload[0]=1;
  payload[11 + 8]=(byte)65;
  payload[11 + 11 + 0]=(byte)76;
  payload[11 + 11 + 1]=(byte)105;
  payload[11 + 11 + 2]=(byte)77;
  payload[11 + 11 + 3]=(byte)69;
  payload[11 + 11 + 4+ 0]=(byte)2;
  qr=new QueryReply(new byte[16],(byte)5,(byte)0,payload);
  qr.getResults();
  try {
    qr.getVendor();
    fail("String_Node_Str");
  }
 catch (  BadPacketException e) {
  }
  payload=new byte[11 + 11 + (4 + 1 + 4+ 1)+ 16];
  payload[0]=1;
  payload[11 + 8]=(byte)65;
  payload[11 + 11 + 0]=(byte)76;
  payload[11 + 11 + 1]=(byte)105;
  payload[11 + 11 + 2]=(byte)77;
  payload[11 + 11 + 3]=(byte)69;
  payload[11 + 11 + 4+ 0]=(byte)QueryReply.COMMON_PAYLOAD_LEN;
  payload[11 + 11 + 4+ 1]=(byte)0x0;
  payload[11 + 11 + 4+ 1+ 1]=(byte)0x0;
  payload[11 + 11 + 4+ 1+ 2]=(byte)1;
  qr=new QueryReply(new byte[16],(byte)5,(byte)0,payload);
  vendor=qr.getVendor();
  assertEquals("String_Node_Str","String_Node_Str",vendor);
  assertTrue(!qr.getNeedsPush());
  try {
    qr.getIsBusy();
    fail("String_Node_Str");
  }
 catch (  BadPacketException e) {
  }
  try {
    qr.getHadSuccessfulUpload();
    fail("String_Node_Str");
  }
 catch (  BadPacketException e) {
  }
  try {
    qr.getIsMeasuredSpeed();
    fail("String_Node_Str");
  }
 catch (  BadPacketException e) {
  }
  payload=new byte[11 + 11 + (4 + 1 + 4+ 1+ 1)+ 16];
  payload[0]=1;
  payload[11 + 8]=(byte)65;
  payload[11 + 11 + 0]=(byte)76;
  payload[11 + 11 + 1]=(byte)73;
  payload[11 + 11 + 2]=(byte)77;
  payload[11 + 11 + 3]=(byte)69;
  payload[11 + 11 + 4]=(byte)QueryReply.COMMON_PAYLOAD_LEN;
  payload[11 + 11 + 4+ 1]=(byte)0x1d;
  payload[11 + 11 + 4+ 1+ 1]=(byte)0x1c;
  payload[11 + 11 + 4+ 1+ 2]=(byte)1;
  payload[11 + 11 + 4+ 1+ 4]=(byte)0x1;
  qr=new QueryReply(new byte[16],(byte)5,(byte)0,payload);
  vendor=qr.getVendor();
  assertEquals(vendor,"String_Node_Str",vendor);
  assertTrue(qr.getNeedsPush());
  assertTrue(qr.getNeedsPush());
  assertTrue(qr.getIsBusy());
  assertTrue(qr.getIsBusy());
  assertTrue(qr.getIsMeasuredSpeed());
  assertTrue(qr.getIsMeasuredSpeed());
  assertTrue(qr.getHadSuccessfulUpload());
  assertTrue(qr.getHadSuccessfulUpload());
  assertTrue(qr.getSupportsChat());
  payload=new byte[11 + 11 + (4 + 1 + 4+ 1)+ 16];
  payload[0]=1;
  payload[11 + 8]=(byte)65;
  payload[11 + 11 + 0]=(byte)76;
  payload[11 + 11 + 1]=(byte)105;
  payload[11 + 11 + 2]=(byte)77;
  payload[11 + 11 + 3]=(byte)69;
  payload[11 + 11 + 4]=(byte)QueryReply.COMMON_PAYLOAD_LEN;
  payload[11 + 11 + 4+ 1]=(byte)0x1c;
  payload[11 + 11 + 4+ 1+ 1]=(byte)0x0;
  payload[11 + 11 + 4+ 1+ 2]=(byte)1;
  qr=new QueryReply(new byte[16],(byte)5,(byte)0,payload);
  vendor=qr.getVendor();
  assertEquals(vendor,"String_Node_Str",vendor);
  assertFalse(qr.getNeedsPush());
  assertFalse(qr.getIsBusy());
  assertFalse(qr.getIsMeasuredSpeed());
  assertFalse(qr.getHadSuccessfulUpload());
  try {
    qr.getSupportsChat();
    fail("String_Node_Str");
  }
 catch (  BadPacketException e) {
  }
  responses=new Response[2];
  responses[0]=new Response(11,22,"String_Node_Str");
  responses[1]=new Response(0x2FF2,0xF11F,"String_Node_Str");
  qr=new QueryReply(guid,(byte)5,0xFFFF,ip,u4,responses,guid,false,true,true,false,true,false);
  assertEquals("String_Node_Str",qr.getIP());
  assertEquals(0xFFFF,qr.getPort());
  assertEquals(u4,qr.getSpeed());
  assertTrue(Arrays.equals(qr.getClientGUID(),guid));
  iter=qr.getResults();
  r1=(Response)iter.next();
  assertEquals(r1,responses[0]);
  r2=(Response)iter.next();
  assertEquals(r2,responses[1]);
  assertFalse(iter.hasNext());
  assertEquals("String_Node_Str",qr.getVendor());
  assertFalse(qr.getNeedsPush());
  assertTrue(qr.getIsBusy());
  assertTrue(qr.getHadSuccessfulUpload());
  assertFalse(qr.getIsMeasuredSpeed());
  assertTrue(qr.getSupportsChat());
  assertTrue(qr.getSupportsBrowseHost());
  assertTrue(!qr.isReplyToMulticastQuery());
  responses=new Response[2];
  responses[0]=new Response(11,22,"String_Node_Str");
  responses[1]=new Response(0x2FF2,0xF11F,"String_Node_Str");
  qr=new QueryReply(guid,(byte)5,0xFFFF,ip,u4,responses,guid,true,false,false,true,false,false);
  assertEquals("String_Node_Str",qr.getVendor());
  assertTrue(qr.getNeedsPush());
  assertFalse(qr.getIsBusy());
  assertFalse(qr.getHadSuccessfulUpload());
  assertTrue(qr.getIsMeasuredSpeed());
  assertFalse(qr.getSupportsChat());
  assertTrue(qr.getSupportsBrowseHost());
  assertTrue(!qr.isReplyToMulticastQuery());
  ByteArrayOutputStream out=new ByteArrayOutputStream();
  qr.write(out);
  byte[] bytes=out.toByteArray();
  int ggepLen=_ggepUtil.getQRGGEP(true,false).length;
  assertEquals((23 + 11 + 16) + (8 + 10 + 2) + (8 + 14 + 2)+ (4 + 1 + QueryReply.COMMON_PAYLOAD_LEN+ 1+ 1)+ ggepLen,bytes.length);
  assertEquals(0x3d,bytes[bytes.length - 16 - 6- ggepLen]);
  assertEquals(0x31,bytes[bytes.length - 16 - 5- ggepLen]);
  qr=(QueryReply)Message.read(new ByteArrayInputStream(bytes));
  assertEquals("String_Node_Str",qr.getVendor());
  assertTrue(qr.getNeedsPush());
  assertFalse(qr.getIsBusy());
  assertFalse(qr.getHadSuccessfulUpload());
  assertTrue(qr.getIsMeasuredSpeed());
  assertFalse(qr.getSupportsChat());
  assertTrue(qr.getSupportsBrowseHost());
  assertTrue(!qr.isReplyToMulticastQuery());
  responses=new Response[2];
  responses[0]=new Response(11,22,"String_Node_Str");
  responses[1]=new Response(0x2FF2,0xF11F,"String_Node_Str");
  qr=new QueryReply(guid,(byte)5,0xFFFF,ip,u4,responses,guid,true,false,false,true,false,false);
  assertEquals("String_Node_Str",qr.getVendor());
  assertTrue(qr.getNeedsPush());
  assertFalse(qr.getIsBusy());
  assertFalse(qr.getHadSuccessfulUpload());
  assertTrue(qr.getIsMeasuredSpeed());
  assertFalse(qr.getSupportsChat());
  assertTrue(qr.getSupportsBrowseHost());
  assertFalse(qr.isReplyToMulticastQuery());
  out=new ByteArrayOutputStream();
  qr.write(out);
  bytes=out.toByteArray();
  ggepLen=_ggepUtil.getQRGGEP(true,false).length;
  assertEquals((23 + 11 + 16) + (8 + 10 + 2) + (8 + 14 + 2)+ (4 + 1 + QueryReply.COMMON_PAYLOAD_LEN+ 1+ 1)+ ggepLen,bytes.length);
  assertEquals(0x3d,bytes[bytes.length - 16 - 6- ggepLen]);
  assertEquals(0x31,bytes[bytes.length - 16 - 5- ggepLen]);
  qr=(QueryReply)Message.read(new ByteArrayInputStream(bytes));
  assertEquals("String_Node_Str",qr.getVendor());
  assertTrue(qr.getNeedsPush());
  assertFalse(qr.getIsBusy());
  assertFalse(qr.getHadSuccessfulUpload());
  assertTrue(qr.getIsMeasuredSpeed());
  assertFalse(qr.getSupportsChat());
  assertTrue(qr.getSupportsBrowseHost());
  assertFalse(qr.isReplyToMulticastQuery());
  responses=new Response[2];
  responses[0]=new Response(11,22,"String_Node_Str");
  responses[1]=new Response(0x2FF2,0xF11F,"String_Node_Str");
  qr=new QueryReply(guid,(byte)5,0xFFFF,ip,u4,responses,guid,false);
  try {
    qr.getVendor();
    fail("String_Node_Str");
  }
 catch (  BadPacketException e) {
  }
  try {
    qr.getNeedsPush();
    fail("String_Node_Str");
  }
 catch (  BadPacketException e) {
  }
  try {
    qr.getIsBusy();
    fail("String_Node_Str");
  }
 catch (  BadPacketException e) {
  }
  try {
    qr.getHadSuccessfulUpload();
    fail("String_Node_Str");
  }
 catch (  BadPacketException e) {
  }
  try {
    qr.getIsMeasuredSpeed();
    fail("String_Node_Str");
  }
 catch (  BadPacketException e) {
  }
}