Program: 4734
Project: 4734
Buggy source:
/** 
 * Runs the legacy unit test that was formerly in QueryReply.
 */
public void testLegacyUnitTest(){
  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);
  assertEquals(qr.getSpeed(),1);
  assertEquals(Integer.toHexString(qr.getPort()),qr.getPort(),0xF3F1);
  try {
    assertEquals(qr.getResults().hasNext(),false);
  }
 catch (  BadPacketException e) {
    assertTrue(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);
  assertEquals(qr.getIP(),"String_Node_Str");
  assertEquals(qr.getPort(),0xFFFF);
  assertEquals(qr.getSpeed(),u4);
  assertEquals(Arrays.equals(qr.getClientGUID(),guid),true);
  try {
    Iterator iter=qr.getResults();
    Response r1=(Response)iter.next();
    assertEquals(r1,responses[0]);
    Response r2=(Response)iter.next();
    assertEquals(r2,responses[1]);
    assertEquals(iter.hasNext(),false);
  }
 catch (  BadPacketException e) {
    assertTrue(false);
  }
catch (  NoSuchElementException e) {
    assertTrue(false);
  }
  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);
  try {
    Iterator iter=qr.getResults();
    Response response=(Response)iter.next();
    assertEquals("String_Node_Str" + response.getName() + "String_Node_Str",response.getName(),"String_Node_Str");
    assertEquals(iter.hasNext(),false);
  }
 catch (  BadPacketException e) {
    assertTrue(false);
  }
  try {
    qr.getVendor();
    assertTrue(false);
  }
 catch (  BadPacketException e) {
  }
  try {
    qr.getNeedsPush();
    assertTrue(false);
  }
 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 {
    Iterator iter=qr.getResults();
    assertTrue(false);
  }
 catch (  BadPacketException e) {
  }
  try {
    qr.getVendor();
    assertTrue(false);
  }
 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 {
    Iterator iter=qr.getResults();
    Response r=(Response)iter.next();
    assertEquals("String_Node_Str",r.getNameBytesSize(),1);
    assertEquals("String_Node_Str",r.getMetaBytesSize(),0);
    byte[] name=r.getNameBytes();
    assertEquals("String_Node_Str",name[0],'A');
    assertEquals("String_Node_Str",r.getName(),"String_Node_Str");
    assertEquals("String_Node_Str" + (new String(qr.getXMLBytes())),(new String(qr.getXMLBytes())),"String_Node_Str");
  }
 catch (  BadPacketException e) {
    System.out.println("String_Node_Str");
  }
  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);
  try {
    String vendor=qr.getVendor();
    assertEquals(vendor,"String_Node_Str",vendor);
    vendor=qr.getVendor();
    assertEquals(vendor,"String_Node_Str",vendor);
    assertEquals(qr.getNeedsPush(),true);
  }
 catch (  BadPacketException e) {
    System.out.println(e.toString());
    assertTrue(false);
  }
  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);
  try {
    String vendor=qr.getVendor();
    assertEquals(vendor,"String_Node_Str",vendor);
    vendor=qr.getVendor();
    assertEquals(vendor,"String_Node_Str",vendor);
    assertEquals(qr.getNeedsPush(),false);
  }
 catch (  BadPacketException e) {
    assertTrue(false);
    e.printStackTrace();
  }
  try {
    qr.getSupportsChat();
    assertTrue(false);
  }
 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();
    assertTrue(false);
  }
 catch (  BadPacketException e) {
  }
  try {
    qr.getVendor();
    assertTrue(false);
  }
 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);
  try {
    qr.getResults();
  }
 catch (  BadPacketException e) {
    assertTrue(false);
  }
  try {
    qr.getVendor();
    assertTrue(false);
  }
 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);
  try {
    String vendor=qr.getVendor();
    assertEquals(vendor,vendor,"String_Node_Str");
    vendor=qr.getVendor();
    assertEquals(vendor,vendor,"String_Node_Str");
  }
 catch (  BadPacketException e) {
    System.out.println(e.toString());
    assertTrue(false);
  }
  try {
    assertEquals(qr.getNeedsPush(),false);
  }
 catch (  BadPacketException e) {
  }
  try {
    qr.getIsBusy();
    assertTrue(false);
  }
 catch (  BadPacketException e) {
  }
  try {
    qr.getHadSuccessfulUpload();
    assertTrue(false);
  }
 catch (  BadPacketException e) {
  }
  try {
    qr.getIsMeasuredSpeed();
    assertTrue(false);
  }
 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);
  try {
    String vendor=qr.getVendor();
    assertEquals(vendor,"String_Node_Str",vendor);
    assertEquals(qr.getNeedsPush(),true);
    assertEquals(qr.getNeedsPush(),true);
    assertEquals(qr.getIsBusy(),true);
    assertEquals(qr.getIsBusy(),true);
    assertEquals(qr.getIsMeasuredSpeed(),true);
    assertEquals(qr.getIsMeasuredSpeed(),true);
    assertEquals(qr.getHadSuccessfulUpload(),true);
    assertEquals(qr.getHadSuccessfulUpload(),true);
    assertEquals(qr.getSupportsChat(),true);
  }
 catch (  BadPacketException e) {
    System.out.println(e.toString());
    assertTrue(false);
  }
  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);
  try {
    String vendor=qr.getVendor();
    assertEquals(vendor,"String_Node_Str",vendor);
    assertEquals(qr.getNeedsPush(),false);
    assertEquals(qr.getIsBusy(),false);
    assertEquals(qr.getIsMeasuredSpeed(),false);
    assertEquals(qr.getHadSuccessfulUpload(),false);
  }
 catch (  BadPacketException e) {
    System.out.println(e.toString());
    assertTrue(false);
  }
  try {
    qr.getSupportsChat();
    assertTrue(false);
  }
 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);
  assertEquals(qr.getIP(),"String_Node_Str");
  assertEquals(qr.getPort(),0xFFFF);
  assertEquals(qr.getSpeed(),u4);
  assertTrue(Arrays.equals(qr.getClientGUID(),guid));
  try {
    Iterator iter=qr.getResults();
    Response r1=(Response)iter.next();
    assertEquals(r1,responses[0]);
    Response r2=(Response)iter.next();
    assertEquals(r2,responses[1]);
    assertEquals(iter.hasNext(),false);
    assertEquals(qr.getVendor(),"String_Node_Str");
    assertEquals(qr.getNeedsPush(),false);
    assertEquals(qr.getIsBusy(),true);
    assertEquals(qr.getHadSuccessfulUpload(),true);
    assertEquals(qr.getIsMeasuredSpeed(),false);
    assertEquals(qr.getSupportsChat(),true);
  }
 catch (  BadPacketException e) {
    assertTrue(false);
  }
catch (  NoSuchElementException e) {
    assertTrue(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,true,false,false,true,false);
  try {
    assertEquals(qr.getVendor(),"String_Node_Str");
    assertEquals(qr.getNeedsPush(),true);
    assertEquals(qr.getIsBusy(),false);
    assertEquals(qr.getHadSuccessfulUpload(),false);
    assertEquals(qr.getIsMeasuredSpeed(),true);
    assertEquals(qr.getSupportsChat(),false);
  }
 catch (  BadPacketException e) {
    assertTrue(false);
  }
catch (  NoSuchElementException e) {
    assertTrue(false);
  }
  ByteArrayOutputStream out=new ByteArrayOutputStream();
  try {
    qr.write(out);
  }
 catch (  IOException e) {
    assertTrue(false);
  }
  byte[] bytes=out.toByteArray();
  final int ggepLen=GGEPUtil.getQRGGEP(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);
  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);
  try {
    qr.getVendor();
    assertTrue(false);
  }
 catch (  BadPacketException e) {
  }
  try {
    qr.getNeedsPush();
    assertTrue(false);
  }
 catch (  BadPacketException e) {
  }
  try {
    qr.getIsBusy();
    assertTrue(false);
  }
 catch (  BadPacketException e) {
  }
  try {
    qr.getHadSuccessfulUpload();
    assertTrue(false);
  }
 catch (  BadPacketException e) {
  }
  try {
    qr.getIsMeasuredSpeed();
    assertTrue(false);
  }
 catch (  BadPacketException e) {
  }
}

Fixed version (ground truth):
/** 
 * Runs the legacy unit test that was formerly in QueryReply.
 */
public void testLegacyUnitTest(){
  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);
  assertEquals(qr.getSpeed(),1);
  assertEquals(Integer.toHexString(qr.getPort()),qr.getPort(),0xF3F1);
  try {
    assertEquals(qr.getResults().hasNext(),false);
  }
 catch (  BadPacketException e) {
    assertTrue(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);
  assertEquals(qr.getIP(),"String_Node_Str");
  assertEquals(qr.getPort(),0xFFFF);
  assertEquals(qr.getSpeed(),u4);
  assertEquals(Arrays.equals(qr.getClientGUID(),guid),true);
  try {
    Iterator iter=qr.getResults();
    Response r1=(Response)iter.next();
    assertEquals(r1,responses[0]);
    Response r2=(Response)iter.next();
    assertEquals(r2,responses[1]);
    assertEquals(iter.hasNext(),false);
  }
 catch (  BadPacketException e) {
    assertTrue(false);
  }
catch (  NoSuchElementException e) {
    assertTrue(false);
  }
  byte[] payload=new byte[11 + 11 + 16];
  payload[0]=1;
  payload[11 + 8]=(byte)65;
  try {
    qr=new QueryReply(new byte[16],(byte)5,(byte)0,payload);
  }
 catch (  BadPacketException e) {
    fail("String_Node_Str" + e);
  }
  try {
    Iterator iter=qr.getResults();
    Response response=(Response)iter.next();
    assertEquals("String_Node_Str" + response.getName() + "String_Node_Str",response.getName(),"String_Node_Str");
    assertEquals(iter.hasNext(),false);
  }
 catch (  BadPacketException e) {
    assertTrue(false);
  }
  try {
    qr.getVendor();
    assertTrue(false);
  }
 catch (  BadPacketException e) {
  }
  try {
    qr.getNeedsPush();
    assertTrue(false);
  }
 catch (  BadPacketException e) {
  }
  payload=new byte[11 + 11 + 15];
  payload[0]=1;
  payload[11 + 8]=(byte)65;
  try {
    qr=new QueryReply(new byte[16],(byte)5,(byte)0,payload);
  }
 catch (  BadPacketException e) {
    fail("String_Node_Str" + e);
  }
  try {
    Iterator iter=qr.getResults();
    assertTrue(false);
  }
 catch (  BadPacketException e) {
  }
  try {
    qr.getVendor();
    assertTrue(false);
  }
 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;
  try {
    qr=new QueryReply(new byte[16],(byte)5,(byte)0,payload);
  }
 catch (  BadPacketException e) {
    fail("String_Node_Str" + e);
  }
  try {
    Iterator iter=qr.getResults();
    Response r=(Response)iter.next();
    assertEquals("String_Node_Str",r.getNameBytesSize(),1);
    assertEquals("String_Node_Str",r.getMetaBytesSize(),0);
    byte[] name=r.getNameBytes();
    assertEquals("String_Node_Str",name[0],'A');
    assertEquals("String_Node_Str",r.getName(),"String_Node_Str");
    assertEquals("String_Node_Str" + (new String(qr.getXMLBytes())),(new String(qr.getXMLBytes())),"String_Node_Str");
  }
 catch (  BadPacketException e) {
    System.out.println("String_Node_Str");
  }
  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;
  try {
    qr=new QueryReply(new byte[16],(byte)5,(byte)0,payload);
  }
 catch (  BadPacketException e) {
    fail("String_Node_Str" + e);
  }
  try {
    String vendor=qr.getVendor();
    assertEquals(vendor,"String_Node_Str",vendor);
    vendor=qr.getVendor();
    assertEquals(vendor,"String_Node_Str",vendor);
    assertEquals(qr.getNeedsPush(),true);
  }
 catch (  BadPacketException e) {
    System.out.println(e.toString());
    assertTrue(false);
  }
  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';
  try {
    qr=new QueryReply(new byte[16],(byte)5,(byte)0,payload);
  }
 catch (  BadPacketException e) {
    fail("String_Node_Str" + e);
  }
  try {
    String vendor=qr.getVendor();
    assertEquals(vendor,"String_Node_Str",vendor);
    vendor=qr.getVendor();
    assertEquals(vendor,"String_Node_Str",vendor);
    assertEquals(qr.getNeedsPush(),false);
  }
 catch (  BadPacketException e) {
    assertTrue(false);
    e.printStackTrace();
  }
  try {
    qr.getSupportsChat();
    assertTrue(false);
  }
 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;
  try {
    qr=new QueryReply(new byte[16],(byte)5,(byte)0,payload);
  }
 catch (  BadPacketException e) {
    fail("String_Node_Str" + e);
  }
  try {
    qr.getNeedsPush();
    assertTrue(false);
  }
 catch (  BadPacketException e) {
  }
  try {
    qr.getVendor();
    assertTrue(false);
  }
 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;
  try {
    qr=new QueryReply(new byte[16],(byte)5,(byte)0,payload);
  }
 catch (  BadPacketException e) {
    fail("String_Node_Str" + e);
  }
  try {
    qr.getResults();
  }
 catch (  BadPacketException e) {
    assertTrue(false);
  }
  try {
    qr.getVendor();
    assertTrue(false);
  }
 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;
  try {
    qr=new QueryReply(new byte[16],(byte)5,(byte)0,payload);
  }
 catch (  BadPacketException e) {
    fail("String_Node_Str" + e);
  }
  try {
    String vendor=qr.getVendor();
    assertEquals(vendor,vendor,"String_Node_Str");
    vendor=qr.getVendor();
    assertEquals(vendor,vendor,"String_Node_Str");
  }
 catch (  BadPacketException e) {
    System.out.println(e.toString());
    assertTrue(false);
  }
  try {
    assertEquals(qr.getNeedsPush(),false);
  }
 catch (  BadPacketException e) {
  }
  try {
    qr.getIsBusy();
    assertTrue(false);
  }
 catch (  BadPacketException e) {
  }
  try {
    qr.getHadSuccessfulUpload();
    assertTrue(false);
  }
 catch (  BadPacketException e) {
  }
  try {
    qr.getIsMeasuredSpeed();
    assertTrue(false);
  }
 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;
  try {
    qr=new QueryReply(new byte[16],(byte)5,(byte)0,payload);
  }
 catch (  BadPacketException e) {
    fail("String_Node_Str" + e);
  }
  try {
    String vendor=qr.getVendor();
    assertEquals(vendor,"String_Node_Str",vendor);
    assertEquals(qr.getNeedsPush(),true);
    assertEquals(qr.getNeedsPush(),true);
    assertEquals(qr.getIsBusy(),true);
    assertEquals(qr.getIsBusy(),true);
    assertEquals(qr.getIsMeasuredSpeed(),true);
    assertEquals(qr.getIsMeasuredSpeed(),true);
    assertEquals(qr.getHadSuccessfulUpload(),true);
    assertEquals(qr.getHadSuccessfulUpload(),true);
    assertEquals(qr.getSupportsChat(),true);
  }
 catch (  BadPacketException e) {
    System.out.println(e.toString());
    assertTrue(false);
  }
  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;
  try {
    qr=new QueryReply(new byte[16],(byte)5,(byte)0,payload);
  }
 catch (  BadPacketException e) {
    fail("String_Node_Str" + e);
  }
  try {
    String vendor=qr.getVendor();
    assertEquals(vendor,"String_Node_Str",vendor);
    assertEquals(qr.getNeedsPush(),false);
    assertEquals(qr.getIsBusy(),false);
    assertEquals(qr.getIsMeasuredSpeed(),false);
    assertEquals(qr.getHadSuccessfulUpload(),false);
  }
 catch (  BadPacketException e) {
    System.out.println(e.toString());
    assertTrue(false);
  }
  try {
    qr.getSupportsChat();
    assertTrue(false);
  }
 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);
  assertEquals(qr.getIP(),"String_Node_Str");
  assertEquals(qr.getPort(),0xFFFF);
  assertEquals(qr.getSpeed(),u4);
  assertTrue(Arrays.equals(qr.getClientGUID(),guid));
  try {
    Iterator iter=qr.getResults();
    Response r1=(Response)iter.next();
    assertEquals(r1,responses[0]);
    Response r2=(Response)iter.next();
    assertEquals(r2,responses[1]);
    assertEquals(iter.hasNext(),false);
    assertEquals(qr.getVendor(),"String_Node_Str");
    assertEquals(qr.getNeedsPush(),false);
    assertEquals(qr.getIsBusy(),true);
    assertEquals(qr.getHadSuccessfulUpload(),true);
    assertEquals(qr.getIsMeasuredSpeed(),false);
    assertEquals(qr.getSupportsChat(),true);
  }
 catch (  BadPacketException e) {
    assertTrue(false);
  }
catch (  NoSuchElementException e) {
    assertTrue(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,true,false,false,true,false);
  try {
    assertEquals(qr.getVendor(),"String_Node_Str");
    assertEquals(qr.getNeedsPush(),true);
    assertEquals(qr.getIsBusy(),false);
    assertEquals(qr.getHadSuccessfulUpload(),false);
    assertEquals(qr.getIsMeasuredSpeed(),true);
    assertEquals(qr.getSupportsChat(),false);
  }
 catch (  BadPacketException e) {
    assertTrue(false);
  }
catch (  NoSuchElementException e) {
    assertTrue(false);
  }
  ByteArrayOutputStream out=new ByteArrayOutputStream();
  try {
    qr.write(out);
  }
 catch (  IOException e) {
    assertTrue(false);
  }
  byte[] bytes=out.toByteArray();
  final int ggepLen=GGEPUtil.getQRGGEP(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);
  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);
  try {
    qr.getVendor();
    assertTrue(false);
  }
 catch (  BadPacketException e) {
  }
  try {
    qr.getNeedsPush();
    assertTrue(false);
  }
 catch (  BadPacketException e) {
  }
  try {
    qr.getIsBusy();
    assertTrue(false);
  }
 catch (  BadPacketException e) {
  }
  try {
    qr.getHadSuccessfulUpload();
    assertTrue(false);
  }
 catch (  BadPacketException e) {
  }
  try {
    qr.getIsMeasuredSpeed();
    assertTrue(false);
  }
 catch (  BadPacketException e) {
  }
}