Program: 4922
Project: 4922
Buggy source:
/** 
 * Checks that HOST:PORT will accept LIMIT connections of the given type, returning the last successful one, or null if none.
 * @param host the host to connect to
 * @param port the port to conenct to
 * @param type the type of connection to establish: LEAF, OLD_04, OLD_06,or ULTRAPEER
 * @param limit the expected number of connections
 * @param rejectType what sort of rejection to expect when over the limit:REJECT_503 (during handshaking) or REJECT_SILENT (during messaging)
 */
private static Connection testLimit(String host,int port,int type,int limit,int rejectType){
  String description=null;
  if (type == OLD_04)   description="String_Node_Str";
 else   if (type == OLD_06)   description="String_Node_Str";
 else   if (type == LEAF)   description="String_Node_Str";
 else   if (type == ULTRAPEER)   description="String_Node_Str";
 else   Assert.that(false,"String_Node_Str" + type);
  System.out.println("String_Node_Str" + limit + "String_Node_Str"+ description+ "String_Node_Str");
  Connection ret=null;
  for (int i=0; i < limit; i++) {
    try {
      ret=connect(host,port,type);
    }
 catch (    IOException e) {
      Assert.that(false,"String_Node_Str" + i + "String_Node_Str");
    }
    buffer.add(ret);
  }
  try {
    Connection tmp=connect(host,port,type);
    Assert.that(false,"String_Node_Str");
  }
 catch (  NoGnutellaOkException e) {
    Assert.that(rejectType == REJECT_503 && e.getCode() == HandshakeResponse.SLOTS_FULL,"String_Node_Str" + e.getCode());
  }
catch (  IOException e) {
    Assert.that(rejectType == REJECT_SILENT,"String_Node_Str" + e);
  }
  return ret;
}

Fixed version (ground truth):
/** 
 * Checks that HOST:PORT will accept LIMIT connections of the given type, returning the last successful one, or null if none.
 * @param host the host to connect to
 * @param port the port to conenct to
 * @param type the type of connection to establish: LEAF, OLD_04, OLD_06,or ULTRAPEER
 * @param limit the expected number of connections
 * @param rejectType what sort of rejection to expect when over the limit:REJECT_503 (during handshaking) or REJECT_SILENT (during messaging)
 */
private static Connection testLimit(String host,int port,int type,int limit,int rejectType){
  String description=null;
  if (type == OLD_04)   description="String_Node_Str";
 else   if (type == OLD_06)   description="String_Node_Str";
 else   if (type == LEAF)   description="String_Node_Str";
 else   if (type == ULTRAPEER)   description="String_Node_Str";
 else   Assert.that(false,"String_Node_Str" + type);
  System.out.println("String_Node_Str" + limit + "String_Node_Str"+ description+ "String_Node_Str");
  Connection ret=null;
  for (int i=0; i < limit; i++) {
    try {
      ret=connect(host,port,type);
    }
 catch (    IOException e) {
      e.printStackTrace();
      if (e instanceof NoGnutellaOkException) {
        System.out.println("String_Node_Str" + ((NoGnutellaOkException)e).getCode());
      }
      Assert.that(false,"String_Node_Str" + i + "String_Node_Str");
    }
    buffer.add(ret);
  }
  try {
    Connection tmp=connect(host,port,type);
    Assert.that(false,"String_Node_Str");
  }
 catch (  NoGnutellaOkException e) {
    Assert.that(rejectType == REJECT_503 && e.getCode() == HandshakeResponse.SLOTS_FULL,"String_Node_Str" + e.getCode());
  }
catch (  IOException e) {
    Assert.that(rejectType == REJECT_SILENT,"String_Node_Str" + e);
  }
  return ret;
}