Program: 4533
Project: 4533
Buggy source:
public void testPushProxyRequest() throws Exception {
  drain(testUP);
  final byte[] clientGUID=GUID.makeGuid();
  byte[] guid=GUID.makeGuid();
  rs.query(guid,"String_Node_Str");
  Message m=null;
  do {
    m=testUP.receive(TIMEOUT);
  }
 while (!(m instanceof QueryRequest));
  ServerSocket ss=new ServerSocket(7000);
  ss.setReuseAddress(true);
  ss.setSoTimeout(TIMEOUT * 4);
  final 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,6999,InetAddress.getLocalHost().getAddress(),0,res,clientGUID,new byte[0],false,false,true,true,false,false,proxies);
  testUP.send(m);
  testUP.flush();
  Thread.sleep(1000);
  assertTrue(callback.getRFD() != null);
  rs.doAsynchronousBrowseHost(callback.getRFD().getHost(),callback.getRFD().getPort(),new GUID(GUID.makeGuid()),new GUID(clientGUID),proxies);
  Socket httpSock=ss.accept();
  assertNotNull(httpSock);
  BufferedWriter sockWriter=new BufferedWriter(new OutputStreamWriter(httpSock.getOutputStream()));
  sockWriter.write("String_Node_Str");
  sockWriter.flush();
  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(),rs.getAddress());
  assertEquals(Integer.parseInt(st.nextToken()),PORT);
  Socket push=new Socket(InetAddress.getLocalHost(),PORT);
  BufferedWriter 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();
  assertTrue(currLine.startsWith("String_Node_Str"));
  currLine=reader.readLine();
  assertTrue(currLine.startsWith("String_Node_Str"));
  st=new StringTokenizer(currLine,"String_Node_Str");
  assertEquals(st.nextToken(),"String_Node_Str");
  addr=InetAddress.getByName(st.nextToken().trim());
  Arrays.equals(addr.getAddress(),rs.getAddress());
  assertEquals(Integer.parseInt(st.nextToken()),PORT);
  Thread.sleep(500);
  writer=new BufferedWriter(new OutputStreamWriter(push.getOutputStream()));
  writer.write("String_Node_Str");
  writer.flush();
  writer.write("String_Node_Str");
  writer.flush();
  httpSock.close();
  try {
    do {
      m=testUP.receive(TIMEOUT);
      assertNotInstanceof(m.toString(),PushRequest.class,m);
    }
 while (true);
  }
 catch (  InterruptedIOException expected) {
  }
  ss.close();
}

Fixed version (ground truth):
public void testPushProxyRequest() throws Exception {
  drain(testUP);
  final byte[] clientGUID=GUID.makeGuid();
  byte[] guid=GUID.makeGuid();
  RouterService.query(guid,"String_Node_Str");
  Message m=null;
  do {
    m=testUP.receive(TIMEOUT);
  }
 while (!(m instanceof QueryRequest));
  ServerSocket ss=new ServerSocket(7000);
  ss.setReuseAddress(true);
  ss.setSoTimeout(TIMEOUT * 4);
  final 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,6999,InetAddress.getLocalHost().getAddress(),0,res,clientGUID,new byte[0],false,false,true,true,false,false,proxies);
  testUP.send(m);
  testUP.flush();
  Thread.sleep(1000);
  assertTrue(callback.getRFD() != null);
  RouterService.doAsynchronousBrowseHost(callback.getRFD().getHost(),callback.getRFD().getPort(),new GUID(GUID.makeGuid()),new GUID(clientGUID),proxies);
  Socket httpSock=ss.accept();
  assertNotNull(httpSock);
  BufferedWriter sockWriter=new BufferedWriter(new OutputStreamWriter(httpSock.getOutputStream()));
  sockWriter.write("String_Node_Str");
  sockWriter.flush();
  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()),SERVER_PORT);
  Socket push=new Socket(InetAddress.getLocalHost(),SERVER_PORT);
  BufferedWriter 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();
  assertTrue(currLine.startsWith("String_Node_Str"));
  currLine=reader.readLine();
  assertTrue(currLine.startsWith("String_Node_Str"));
  st=new StringTokenizer(currLine,"String_Node_Str");
  assertEquals(st.nextToken(),"String_Node_Str");
  addr=InetAddress.getByName(st.nextToken().trim());
  Arrays.equals(addr.getAddress(),RouterService.getAddress());
  assertEquals(Integer.parseInt(st.nextToken()),SERVER_PORT);
  Thread.sleep(500);
  writer=new BufferedWriter(new OutputStreamWriter(push.getOutputStream()));
  writer.write("String_Node_Str");
  writer.flush();
  writer.write("String_Node_Str");
  writer.flush();
  httpSock.close();
  try {
    do {
      m=testUP.receive(TIMEOUT);
      assertNotInstanceof(m.toString(),PushRequest.class,m);
    }
 while (true);
  }
 catch (  InterruptedIOException expected) {
  }
  ss.close();
}