Program: 35281
Project: 35281
Buggy source:
@Test public void testSendDataResponseFrameTimeout() throws Exception {
  MockChannelHandlerContext ctx=new MockChannelHandlerContext();
  TransactionInboundHandler h=new TransactionInboundHandler();
  h.userEventTriggered(ctx,new DataFrameSentEvent(new SendData("String_Node_Str",(byte)0x01,new byte[]{0x01,0x09,0x00,0x13,0x06,0x02,0x00,0x00,0x25,0x0a,(byte)0xce},(byte)0x05,true),true));
  assertEquals(1,ctx.getUserEvents().size());
  assertEquals(0,ctx.getWriteQueue().size());
  assertTrue(ctx.getUserEvents().get(0) instanceof TransactionStartedEvent);
  h.channelRead(ctx,new ACK());
  assertEquals(1,ctx.getUserEvents().size());
  assertEquals(0,ctx.getWriteQueue().size());
  h.channelRead(ctx,new SendData(Unpooled.wrappedBuffer(new byte[]{0x01,0x04,0x01,0x13,0x01,(byte)0xe8})));
  assertEquals(1,ctx.getUserEvents().size());
  assertEquals(0,ctx.getWriteQueue().size());
  h.channelRead(ctx,new SendData(Unpooled.wrappedBuffer(new byte[]{0x01,0x05,0x00,0x13,0x0a,0x00,(byte)0xe2})));
  assertEquals(1,ctx.getUserEvents().size());
  assertEquals(0,ctx.getWriteQueue().size());
  h.userEventTriggered(ctx,new TransactionTimeoutEvent(h.getCurrentTransaction().getId()));
  assertEquals(1,ctx.getWriteQueue().size());
  assertTrue(ctx.getWriteQueue().get(0) instanceof OutboundDataFrame);
  assertTrue(((OutboundDataFrame)ctx.getWriteQueue().get(0)).getDataFrame() instanceof SendData);
}

Fixed version (ground truth):
@Test public void testSendDataResponseFrameTimeout() throws Exception {
  MockChannelHandlerContext ctx=new MockChannelHandlerContext();
  TransactionInboundHandler h=new TransactionInboundHandler();
  assertEquals(0,ctx.getUserEvents().size());
  SendData sendData=new SendData("String_Node_Str",(byte)0x01,new byte[]{0x01,0x09,0x00,0x13,0x06,0x02,0x00,0x00,0x25,0x0a,(byte)0xce},(byte)0x05,true);
  h.userEventTriggered(ctx,new DataFrameSentEvent(sendData,true));
  assertEquals(1,ctx.getUserEvents().size());
  assertEquals(0,ctx.getWriteQueue().size());
  assertTrue(ctx.getUserEvents().get(0) instanceof TransactionStartedEvent);
  h.channelRead(ctx,new ACK());
  assertEquals(1,ctx.getUserEvents().size());
  assertEquals(0,ctx.getWriteQueue().size());
  h.channelRead(ctx,new SendData(Unpooled.wrappedBuffer(new byte[]{0x01,0x04,0x01,0x13,0x01,(byte)0xe8})));
  assertEquals(1,ctx.getUserEvents().size());
  assertEquals(0,ctx.getWriteQueue().size());
  h.channelRead(ctx,new SendData(Unpooled.wrappedBuffer(new byte[]{0x01,0x05,0x00,0x13,0x0a,0x00,(byte)0xe2})));
  assertEquals(1,ctx.getUserEvents().size());
  assertEquals(0,ctx.getWriteQueue().size());
  h.userEventTriggered(ctx,new TransactionTimeoutEvent(h.getCurrentTransaction().getId()));
  assertEquals(1,ctx.getWriteQueue().size());
  assertTrue(ctx.getWriteQueue().get(0) instanceof OutboundDataFrame);
  assertTrue(((OutboundDataFrame)ctx.getWriteQueue().get(0)).getDataFrame() instanceof SendData);
  sendData.incremenentSendCount();
  h.userEventTriggered(ctx,new TransactionTimeoutEvent(h.getCurrentTransaction().getId()));
  assertEquals(2,ctx.getWriteQueue().size());
  assertTrue(ctx.getWriteQueue().get(1) instanceof OutboundDataFrame);
  assertTrue(((OutboundDataFrame)ctx.getWriteQueue().get(1)).getDataFrame() instanceof SendData);
  sendData.incremenentSendCount();
  assertEquals(1,ctx.getUserEvents().size());
  h.userEventTriggered(ctx,new TransactionTimeoutEvent(h.getCurrentTransaction().getId()));
  assertEquals(2,ctx.getWriteQueue().size());
  assertEquals(2,ctx.getUserEvents().size());
  assertTrue(ctx.getUserEvents().get(1) instanceof TransactionFailedEvent);
  assertTrue(h.hasCurrentTransaction());
  h.userEventTriggered(ctx,ctx.getUserEvents().get(1));
  assertFalse(h.hasCurrentTransaction());
}