Program: 4541
Project: 4541
Buggy source:
public void testBasicGuidance() throws Exception {
  for (int i=0; i < testUPs.length; i++) {
    testUPs[i]=connect(rs,6355 + i,true);
    testUPs[i].send(MessagesSupportedVendorMessage.instance());
    testUPs[i].flush();
    drain(testUPs[i]);
  }
  GUID queryGuid=new GUID(rs.newQueryGUID());
  rs.query(queryGuid.bytes(),"String_Node_Str");
  Thread.sleep(250);
  for (int i=0; i < testUPs.length; i++) {
    QueryRequest qr=getFirstQueryRequest(testUPs[i]);
    assertNotNull(qr);
    assertEquals(new GUID(qr.getGUID()),queryGuid);
  }
  Message m=null;
  assertGreaterThan(REPORT_INTERVAL,4 * testUPs.length);
  for (int i=0; i < testUPs.length; i++) {
    Response[] res=new Response[4];
    res[0]=new Response(10,10,"String_Node_Str" + i);
    res[1]=new Response(10,10,"String_Node_Str" + i);
    res[2]=new Response(10,10,"String_Node_Str" + i);
    res[3]=new Response(10,10,"String_Node_Str" + i);
    m=new QueryReply(queryGuid.bytes(),(byte)1,6355,myIP(),0,res,GUID.makeGuid(),new byte[0],false,false,true,true,false,false,null);
    testUPs[i].send(m);
    testUPs[i].flush();
  }
  for (int i=0; i < testUPs.length; i++) {
    QueryStatusResponse stat=getFirstQueryStatus(testUPs[i]);
    assertNotNull(stat);
    assertEquals(new GUID(stat.getGUID()),queryGuid);
    assertEquals(4,stat.getNumResults());
  }
  rs.stopQuery(queryGuid);
  for (int i=0; i < testUPs.length; i++) {
    QueryStatusResponse stat=getFirstQueryStatus(testUPs[i]);
    assertNotNull(stat);
    assertEquals(new GUID(stat.getGUID()),queryGuid);
    assertEquals(65535,stat.getNumResults());
  }
}

Fixed version (ground truth):
public void testBasicGuidance() throws Exception {
  for (int i=0; i < testUPs.length; i++) {
    testUPs[i]=connect(6355 + i,true);
    testUPs[i].send(MessagesSupportedVendorMessage.instance());
    testUPs[i].flush();
    drain(testUPs[i]);
  }
  GUID queryGuid=new GUID(RouterService.newQueryGUID());
  RouterService.query(queryGuid.bytes(),"String_Node_Str");
  Thread.sleep(250);
  for (int i=0; i < testUPs.length; i++) {
    QueryRequest qr=getFirstQueryRequest(testUPs[i]);
    assertNotNull(qr);
    assertEquals(new GUID(qr.getGUID()),queryGuid);
  }
  Message m=null;
  assertGreaterThan(REPORT_INTERVAL,4 * testUPs.length);
  for (int i=0; i < testUPs.length; i++) {
    Response[] res=new Response[4];
    res[0]=new Response(10,10,"String_Node_Str" + i);
    res[1]=new Response(10,10,"String_Node_Str" + i);
    res[2]=new Response(10,10,"String_Node_Str" + i);
    res[3]=new Response(10,10,"String_Node_Str" + i);
    m=new QueryReply(queryGuid.bytes(),(byte)1,6355,myIP(),0,res,GUID.makeGuid(),new byte[0],false,false,true,true,false,false,null);
    testUPs[i].send(m);
    testUPs[i].flush();
  }
  for (int i=0; i < testUPs.length; i++) {
    QueryStatusResponse stat=getFirstQueryStatus(testUPs[i]);
    assertNotNull(stat);
    assertEquals(new GUID(stat.getGUID()),queryGuid);
    assertEquals(4,stat.getNumResults());
  }
  RouterService.stopQuery(queryGuid);
  for (int i=0; i < testUPs.length; i++) {
    QueryStatusResponse stat=getFirstQueryStatus(testUPs[i]);
    assertNotNull(stat);
    assertEquals(new GUID(stat.getGUID()),queryGuid);
    assertEquals(65535,stat.getNumResults());
  }
}