Program: 41148
Project: 41148
Buggy source:
@Test(timeout=5000) public void testReceiveBasicBytesMessageWithContentUsingDataSection() throws Exception {
  try (TestAmqpPeer testPeer=new TestAmqpPeer(IntegrationTestFixture.PORT)){
    Connection connection=testFixture.establishConnecton(testPeer);
    connection.start();
    testPeer.expectBegin(true);
    Session session=connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
    Queue queue=session.createQueue("String_Node_Str");
    PropertiesDescribedType properties=new PropertiesDescribedType();
    properties.setContentType(Symbol.valueOf(AmqpMessageSupport.OCTET_STREAM_CONTENT_TYPE));
    MessageAnnotationsDescribedType msgAnnotations=new MessageAnnotationsDescribedType();
    msgAnnotations.setSymbolKeyedAnnotation(AmqpMessageSupport.JMS_MSG_TYPE,AmqpMessageSupport.JMS_BYTES_MESSAGE);
    final byte[] expectedContent="String_Node_Str".getBytes();
    DescribedType dataContent=new DataDescribedType(new Binary(expectedContent));
    testPeer.expectReceiverAttach();
    testPeer.expectLinkFlowRespondWithTransfer(null,msgAnnotations,properties,null,dataContent);
    testPeer.expectDispositionThatIsAcceptedAndSettled();
    MessageConsumer messageConsumer=session.createConsumer(queue);
    Message receivedMessage=messageConsumer.receive(1000);
    testPeer.waitForAllHandlersToComplete(3000);
    assertNotNull(receivedMessage);
    assertTrue(receivedMessage instanceof BytesMessage);
    BytesMessage bytesMessage=(BytesMessage)receivedMessage;
    assertEquals(expectedContent.length,bytesMessage.getBodyLength());
    byte[] recievedContent=new byte[expectedContent.length];
    int readBytes=bytesMessage.readBytes(recievedContent);
    assertEquals(recievedContent.length,readBytes);
    assertTrue(Arrays.equals(expectedContent,recievedContent));
  }
 }

Fixed version (ground truth):
@Test(timeout=5000) public void testReceiveBasicBytesMessageWithContentUsingDataSection() throws Exception {
  try (TestAmqpPeer testPeer=new TestAmqpPeer(testFixture.getAvailablePort())){
    Connection connection=testFixture.establishConnecton(testPeer);
    connection.start();
    testPeer.expectBegin(true);
    Session session=connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
    Queue queue=session.createQueue("String_Node_Str");
    PropertiesDescribedType properties=new PropertiesDescribedType();
    properties.setContentType(Symbol.valueOf(AmqpMessageSupport.OCTET_STREAM_CONTENT_TYPE));
    MessageAnnotationsDescribedType msgAnnotations=new MessageAnnotationsDescribedType();
    msgAnnotations.setSymbolKeyedAnnotation(AmqpMessageSupport.JMS_MSG_TYPE,AmqpMessageSupport.JMS_BYTES_MESSAGE);
    final byte[] expectedContent="String_Node_Str".getBytes();
    DescribedType dataContent=new DataDescribedType(new Binary(expectedContent));
    testPeer.expectReceiverAttach();
    testPeer.expectLinkFlowRespondWithTransfer(null,msgAnnotations,properties,null,dataContent);
    testPeer.expectDispositionThatIsAcceptedAndSettled();
    MessageConsumer messageConsumer=session.createConsumer(queue);
    Message receivedMessage=messageConsumer.receive(1000);
    testPeer.waitForAllHandlersToComplete(3000);
    assertNotNull(receivedMessage);
    assertTrue(receivedMessage instanceof BytesMessage);
    BytesMessage bytesMessage=(BytesMessage)receivedMessage;
    assertEquals(expectedContent.length,bytesMessage.getBodyLength());
    byte[] recievedContent=new byte[expectedContent.length];
    int readBytes=bytesMessage.readBytes(recievedContent);
    assertEquals(recievedContent.length,readBytes);
    assertTrue(Arrays.equals(expectedContent,recievedContent));
  }
 }