Program: 21520
Project: 21520
Buggy source:
@Test(timeout=5000) public void retryRecoverableErrors() throws Exception {
  logTestStart();
  String testURI="String_Node_Str";
  BodyQName ref=BodyQName.createWithPrefix(testURI,"String_Node_Str","String_Node_Str");
  session.send(ComposableBody.builder().build());
  StubConnection conn=cm.awaitConnection();
  AbstractBody scr=this.getSessionCreationResponse(conn.getRequest().getBody()).setAttribute(Attributes.REQUESTS,"String_Node_Str").build();
  conn.sendResponse(scr);
  session.drain();
  session.addBOSHClientRequestListener(new BOSHClientRequestListener(){
    public void requestSent(    BOSHMessageEvent event){
      try {
        Thread.sleep(10);
      }
 catch (      InterruptedException intx) {
      }
    }
  }
);
  session.send(ComposableBody.builder().setNamespaceDefinition("String_Node_Str",testURI).setAttribute(ref,"String_Node_Str").build());
  StubConnection conn1=cm.awaitConnection();
  session.send(ComposableBody.builder().setNamespaceDefinition("String_Node_Str",testURI).setAttribute(ref,"String_Node_Str").build());
  StubConnection conn2=cm.awaitConnection();
  String expected2=conn2.getRequest().getBody().toXML();
  conn2.sendResponse(ComposableBody.builder().setNamespaceDefinition("String_Node_Str",testURI).setAttribute(ref,"String_Node_Str").build());
  String expected1=conn1.getRequest().getBody().toXML();
  conn1.sendResponse(ComposableBody.builder().setNamespaceDefinition("String_Node_Str",testURI).setAttribute(Attributes.TYPE,"String_Node_Str").setAttribute(ref,"String_Node_Str").build());
  conn=cm.awaitConnection();
  String actual1=conn.getRequest().getBody().toXML();
  conn.sendResponse(ComposableBody.builder().setNamespaceDefinition("String_Node_Str",testURI).setAttribute(ref,"String_Node_Str").build());
  assertEquals(expected1,actual1);
  conn=cm.awaitConnection();
  String actual2=conn.getRequest().getBody().toXML();
  conn.sendResponse(ComposableBody.builder().setNamespaceDefinition("String_Node_Str",testURI).setAttribute(ref,"String_Node_Str").build());
  assertEquals(expected2,actual2);
  session.drain();
}

Fixed version (ground truth):
@Test(timeout=5000) public void retryRecoverableErrors() throws Exception {
  logTestStart();
  String testURI="String_Node_Str";
  BodyQName ref=BodyQName.createWithPrefix(testURI,"String_Node_Str","String_Node_Str");
  session.send(ComposableBody.builder().build());
  StubConnection conn=cm.awaitConnection();
  AbstractBody scr=this.getSessionCreationResponse(conn.getRequest().getBody()).setAttribute(Attributes.REQUESTS,"String_Node_Str").build();
  conn.sendResponse(scr);
  session.drain();
  session.send(ComposableBody.builder().setNamespaceDefinition("String_Node_Str",testURI).setAttribute(ref,"String_Node_Str").build());
  StubConnection conn1=cm.awaitConnection();
  session.send(ComposableBody.builder().setNamespaceDefinition("String_Node_Str",testURI).setAttribute(ref,"String_Node_Str").build());
  StubConnection conn2=cm.awaitConnection();
  String expected2=conn2.getRequest().getBody().toXML();
  conn2.sendResponse(ComposableBody.builder().setNamespaceDefinition("String_Node_Str",testURI).setAttribute(ref,"String_Node_Str").build());
  final ArrayList<String> orderedResends=new ArrayList<String>();
  session.addBOSHClientRequestListener(new BOSHClientRequestListener(){
    public void requestSent(    BOSHMessageEvent event){
synchronized (orderedResends) {
        String actual=event.getBody().toXML();
        orderedResends.add(actual);
        orderedResends.notify();
      }
    }
  }
);
  String expected1=conn1.getRequest().getBody().toXML();
  conn1.sendResponse(ComposableBody.builder().setNamespaceDefinition("String_Node_Str",testURI).setAttribute(Attributes.TYPE,"String_Node_Str").setAttribute(ref,"String_Node_Str").build());
  conn=cm.awaitConnection();
  String actual1=conn.getRequest().getBody().toXML();
  conn.sendResponse(ComposableBody.builder().setNamespaceDefinition("String_Node_Str",testURI).setAttribute(ref,"String_Node_Str").build());
  conn=cm.awaitConnection();
  String actual2=conn.getRequest().getBody().toXML();
  conn.sendResponse(ComposableBody.builder().setNamespaceDefinition("String_Node_Str",testURI).setAttribute(ref,"String_Node_Str").build());
synchronized (orderedResends) {
    while (orderedResends.size() < 2) {
      orderedResends.wait();
    }
  }
  assertEquals(expected1,orderedResends.get(0));
  assertEquals(expected2,orderedResends.get(1));
  if (!(expected1.equals(actual1) && expected2.equals(actual2)) && !(expected1.equals(actual2) && expected2.equals(actual1))) {
    fail("String_Node_Str" + expected1 + "String_Node_Str"+ expected2+ "String_Node_Str"+ actual1+ "String_Node_Str"+ actual2+ "String_Node_Str");
  }
  session.drain();
}