Program: 4792
Project: 4792
Buggy source:
/** 
 * Tests that two requests for the same file on the same connection, does not cause the second request to be queued.
 */
public void testSameFileSameHostGivenSlot(){
  UploadManager upManager=new UploadManager();
  SettingsManager.instance().setMaxUploads(1);
  SettingsManager.instance().setSoftMaxUploads(1);
  SettingsManager.instance().setUploadsPerPerson(99999);
  SettingsManager.instance().setUploadQueueSize(2);
  PipedSocketFactory psf=null;
  try {
    psf=new PipedSocketFactory("String_Node_Str","String_Node_Str",-1,-1);
  }
 catch (  Exception e) {
    fail("String_Node_Str");
  }
  final Socket sa=psf.getSocketA();
  final UploadManager upman=upManager;
  Thread t=new Thread(){
    public void run(){
      upman.acceptUpload(HTTPRequestMethod.GET,sa);
    }
  }
;
  t.setDaemon(true);
  t.start();
  BufferedWriter out=null;
  ByteReader byteReader=null;
  String s=null;
  try {
    Socket sb=psf.getSocketB();
    OutputStream os=sb.getOutputStream();
    out=new BufferedWriter(new OutputStreamWriter(os));
    out.write("String_Node_Str");
    out.write("String_Node_Str" + CommonUtils.getHttpServer() + "String_Node_Str");
    out.write("String_Node_Str");
    out.write("String_Node_Str");
    out.write("String_Node_Str");
    out.flush();
    byteReader=new ByteReader(sb.getInputStream());
    s=byteReader.readLine();
    assertEquals("String_Node_Str",s);
  }
 catch (  Exception e) {
    fail("String_Node_Str");
  }
  try {
    HTTPDownloader d2=addUploader(upManager,rfd2,"String_Node_Str",true);
    connectDloader(d2,true,rfd2,true);
    fail("String_Node_Str");
  }
 catch (  QueuedException qEx) {
    assertEquals(1,qEx.getQueuePosition());
  }
catch (  Exception other) {
    fail("String_Node_Str");
  }
  try {
    while (!s.equals("String_Node_Str"))     s=byteReader.readLine();
    byte[] buf=new byte[1024];
    int d=0;
    while (true) {
      int u=byteReader.read(buf,0,1024);
      d+=u;
      if (d > 11999)       break;
    }
    out.write("String_Node_Str");
    out.write("String_Node_Str" + CommonUtils.getHttpServer() + "String_Node_Str");
    out.write("String_Node_Str");
    out.write("String_Node_Str");
    out.write("String_Node_Str");
    out.flush();
    s=byteReader.readLine();
    assertEquals("String_Node_Str",s);
  }
 catch (  Exception e) {
    fail("String_Node_Str");
  }
  try {
    HTTPDownloader d3=addUploader(upManager,rfd3,"String_Node_Str",true);
    connectDloader(d3,true,rfd2,true);
  }
 catch (  QueuedException q) {
    assertEquals(2,q.getQueuePosition());
  }
catch (  Exception other) {
    fail("String_Node_Str");
  }
  System.out.println("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Tests that two requests for the same file on the same connection, does not cause the second request to be queued.
 */
public void testSameFileSameHostGivenSlot(){
  UploadManager upManager=new UploadManager();
  setUploadManager(upManager);
  SettingsManager.instance().setMaxUploads(1);
  SettingsManager.instance().setSoftMaxUploads(1);
  SettingsManager.instance().setUploadsPerPerson(99999);
  SettingsManager.instance().setUploadQueueSize(2);
  PipedSocketFactory psf=null;
  try {
    psf=new PipedSocketFactory("String_Node_Str","String_Node_Str",-1,-1);
  }
 catch (  Exception e) {
    fail("String_Node_Str");
  }
  final Socket sa=psf.getSocketA();
  final UploadManager upman=upManager;
  Thread t=new Thread(){
    public void run(){
      upman.acceptUpload(HTTPRequestMethod.GET,sa);
    }
  }
;
  t.setDaemon(true);
  t.start();
  BufferedWriter out=null;
  ByteReader byteReader=null;
  String s=null;
  try {
    Socket sb=psf.getSocketB();
    OutputStream os=sb.getOutputStream();
    out=new BufferedWriter(new OutputStreamWriter(os));
    out.write("String_Node_Str");
    out.write("String_Node_Str" + CommonUtils.getHttpServer() + "String_Node_Str");
    out.write("String_Node_Str");
    out.write("String_Node_Str");
    out.write("String_Node_Str");
    out.flush();
    byteReader=new ByteReader(sb.getInputStream());
    s=byteReader.readLine();
    assertEquals("String_Node_Str",s);
  }
 catch (  Exception e) {
    fail("String_Node_Str");
  }
  try {
    HTTPDownloader d2=addUploader(upManager,rfd2,"String_Node_Str",true);
    connectDloader(d2,true,rfd2,true);
    fail("String_Node_Str");
  }
 catch (  QueuedException qEx) {
    assertEquals(1,qEx.getQueuePosition());
  }
catch (  Exception other) {
    fail("String_Node_Str");
  }
  try {
    while (!s.equals("String_Node_Str"))     s=byteReader.readLine();
    byte[] buf=new byte[1024];
    int d=0;
    while (true) {
      int u=byteReader.read(buf,0,1024);
      d+=u;
      if (d > 11999)       break;
    }
    out.write("String_Node_Str");
    out.write("String_Node_Str" + CommonUtils.getHttpServer() + "String_Node_Str");
    out.write("String_Node_Str");
    out.write("String_Node_Str");
    out.write("String_Node_Str");
    out.flush();
    s=byteReader.readLine();
    assertEquals("String_Node_Str",s);
  }
 catch (  Exception e) {
    fail("String_Node_Str");
  }
  try {
    HTTPDownloader d3=addUploader(upManager,rfd3,"String_Node_Str",true);
    connectDloader(d3,true,rfd2,true);
  }
 catch (  QueuedException q) {
    assertEquals(2,q.getQueuePosition());
  }
catch (  Exception other) {
    fail("String_Node_Str");
  }
  System.out.println("String_Node_Str");
}