Program: 4426
Project: 4426
Buggy source:
public void testHTTPRequest() throws Exception {
  drain(testUP[0]);
  byte[] clientGUID=GUID.makeGuid();
  byte[] guid=GUID.makeGuid();
  RouterService.query(guid,"String_Node_Str");
  Message m=null;
  do {
    m=testUP[0].receive(TIMEOUT);
  }
 while (!(m instanceof QueryRequest));
  ServerSocket ss=new ServerSocket(7000);
  ss.setReuseAddress(true);
  ss.setSoTimeout(15 * TIMEOUT);
  Set proxies=new HashSet();
  proxies.add(new QueryReply.PushProxyContainer("String_Node_Str",7000));
  Response[] res=new Response[1];
  res[0]=new Response(10,10,"String_Node_Str");
  m=new QueryReply(m.getGUID(),(byte)1,6355,myIP(),0,res,clientGUID,new byte[0],false,false,true,true,false,false,proxies);
  testUP[0].send(m);
  testUP[0].flush();
  Thread.sleep(1000);
  assertTrue(((MyActivityCallback)getCallback()).getRFD() != null);
  RouterService.download((new RemoteFileDesc[]{((MyActivityCallback)getCallback()).getRFD()}),true,new GUID(m.getGUID()));
  Socket httpSock=ss.accept();
  assertNotNull(httpSock);
  String currLine=null;
  BufferedReader reader=new BufferedReader(new InputStreamReader(httpSock.getInputStream()));
  currLine=reader.readLine();
  assertTrue(currLine.startsWith("String_Node_Str") || currLine.startsWith("String_Node_Str"));
  int beginIndex=currLine.indexOf("String_Node_Str") + 3;
  String guidString=currLine.substring(beginIndex,beginIndex + 26);
  GUID guidFromBackend=new GUID(clientGUID);
  GUID guidFromNetwork=new GUID(Base32.decode(guidString));
  assertEquals(guidFromNetwork,guidFromBackend);
  currLine=reader.readLine();
  assertTrue(currLine.startsWith("String_Node_Str"));
  StringTokenizer st=new StringTokenizer(currLine,"String_Node_Str");
  assertEquals(st.nextToken(),"String_Node_Str");
  InetAddress addr=InetAddress.getByName(st.nextToken().trim());
  Arrays.equals(addr.getAddress(),RouterService.getAddress());
  assertEquals(Integer.parseInt(st.nextToken()),PORT);
  BufferedWriter writer=new BufferedWriter(new OutputStreamWriter(httpSock.getOutputStream()));
  writer.write("String_Node_Str");
  writer.flush();
  httpSock.close();
  try {
    do {
      m=testUP[0].receive(TIMEOUT);
      assertTrue(!(m instanceof PushRequest));
    }
 while (true);
  }
 catch (  InterruptedIOException expected) {
  }
  Socket push=new Socket(InetAddress.getLocalHost(),PORT);
  writer=new BufferedWriter(new OutputStreamWriter(push.getOutputStream()));
  writer.write("String_Node_Str" + new GUID(clientGUID).toHexString() + "String_Node_Str");
  writer.write("String_Node_Str");
  writer.flush();
  reader=new BufferedReader(new InputStreamReader(push.getInputStream()));
  currLine=reader.readLine();
  assertEquals("String_Node_Str",currLine);
  push.close();
  ss.close();
}

Fixed version (ground truth):
public void testHTTPRequest() throws Exception {
  drain(testUP[0]);
  byte[] clientGUID=GUID.makeGuid();
  byte[] guid=GUID.makeGuid();
  RouterService.query(guid,"String_Node_Str");
  Message m=null;
  do {
    m=testUP[0].receive(TIMEOUT);
  }
 while (!(m instanceof QueryRequest));
  ServerSocket ss=new ServerSocket(7000);
  ss.setReuseAddress(true);
  ss.setSoTimeout(25 * TIMEOUT);
  Set proxies=new HashSet();
  proxies.add(new QueryReply.PushProxyContainer("String_Node_Str",7000));
  Response[] res=new Response[1];
  res[0]=new Response(10,10,"String_Node_Str");
  m=new QueryReply(m.getGUID(),(byte)1,6355,myIP(),0,res,clientGUID,new byte[0],false,false,true,true,false,false,proxies);
  testUP[0].send(m);
  testUP[0].flush();
  Thread.sleep(1000);
  assertTrue(((MyActivityCallback)getCallback()).getRFD() != null);
  RouterService.download((new RemoteFileDesc[]{((MyActivityCallback)getCallback()).getRFD()}),true,new GUID(m.getGUID()));
  Socket httpSock=ss.accept();
  assertNotNull(httpSock);
  String currLine=null;
  BufferedReader reader=new BufferedReader(new InputStreamReader(httpSock.getInputStream()));
  currLine=reader.readLine();
  assertTrue(currLine.startsWith("String_Node_Str") || currLine.startsWith("String_Node_Str"));
  int beginIndex=currLine.indexOf("String_Node_Str") + 3;
  String guidString=currLine.substring(beginIndex,beginIndex + 26);
  GUID guidFromBackend=new GUID(clientGUID);
  GUID guidFromNetwork=new GUID(Base32.decode(guidString));
  assertEquals(guidFromNetwork,guidFromBackend);
  currLine=reader.readLine();
  assertTrue(currLine.startsWith("String_Node_Str"));
  StringTokenizer st=new StringTokenizer(currLine,"String_Node_Str");
  assertEquals(st.nextToken(),"String_Node_Str");
  InetAddress addr=InetAddress.getByName(st.nextToken().trim());
  Arrays.equals(addr.getAddress(),RouterService.getAddress());
  assertEquals(Integer.parseInt(st.nextToken()),PORT);
  BufferedWriter writer=new BufferedWriter(new OutputStreamWriter(httpSock.getOutputStream()));
  writer.write("String_Node_Str");
  writer.flush();
  httpSock.close();
  try {
    do {
      m=testUP[0].receive(TIMEOUT);
      assertTrue(!(m instanceof PushRequest));
    }
 while (true);
  }
 catch (  InterruptedIOException expected) {
  }
  Socket push=new Socket(InetAddress.getLocalHost(),PORT);
  writer=new BufferedWriter(new OutputStreamWriter(push.getOutputStream()));
  writer.write("String_Node_Str" + new GUID(clientGUID).toHexString() + "String_Node_Str");
  writer.write("String_Node_Str");
  writer.flush();
  reader=new BufferedReader(new InputStreamReader(push.getInputStream()));
  currLine=reader.readLine();
  assertEquals("String_Node_Str",currLine);
  push.close();
  ss.close();
}