Program: 87176
Project: 87176
Buggy source:
@Test public void intro() throws Exception {
  ClientDispatcher myClient=new ClientDispatcher();
  TransportImpl myTransport=new TransportImpl(null);
  myClient.init(myTransport);
  FDUtil.ensureFD(_tport1.getFD());
  FDUtil.ensureFD(_tport2.getFD());
  _tport1.getFD().pin(_tport1.getFD().getMembers().getMembers().keySet());
  _tport2.getFD().pin(_tport2.getFD().getMembers().getMembers().keySet());
  for (int i=0; i < 5; i++) {
    ByteBuffer myBuffer=ByteBuffer.allocate(4);
    myBuffer.putInt(i);
    Proposal myProp=new Proposal("String_Node_Str",myBuffer.array());
    myClient.send(new Envelope(myProp),_tport2.getLocalAddress());
    VoteOutcome myEv=myClient.getNext(10000);
    Assert.assertFalse((myEv == null));
    Assert.assertTrue(myEv.getResult() == VoteOutcome.Reason.VALUE);
    Assert.assertTrue(myEv.getSeqNum() == i);
  }
  Thread.sleep(2000);
  _node3=new ServerDispatcher(new HowlLogger(_node3Log));
  _tport3=new TransportImpl(new FailureDetectorImpl(5000));
  _node3.init(_tport3);
  _node3.getAcceptorLearner().setRecoveryGracePeriod(1000);
  Assert.assertFalse(FDUtil.testFD(_tport3.getFD(),10000));
  Assert.assertFalse(_tport3.getFD().isMember(_tport3.getLocalAddress()));
  ByteBuffer myBuffer=ByteBuffer.allocate(4);
  myBuffer.putInt(67);
  Proposal myProp=new Proposal("String_Node_Str",myBuffer.array());
  myClient.send(new Envelope(myProp),_tport2.getLocalAddress());
  VoteOutcome myMsg=myClient.getNext(10000);
  Thread.sleep(5000);
  Assert.assertTrue(_node2.getAcceptorLearner().getLowWatermark().getSeqNum() == _node3.getAcceptorLearner().getLowWatermark().getSeqNum());
  Assert.assertEquals(1,_node3.getAcceptorLearner().getStats().getRecoveryCycles());
  Assert.assertFalse(_tport3.getFD().isMember(_tport3.getLocalAddress()));
  Assert.assertFalse(_tport2.getFD().isMember(_tport3.getLocalAddress()));
  myClient.send(new Envelope(myProp),_tport2.getLocalAddress());
  myClient.getNext(10000);
  Thread.sleep(2000);
  Assert.assertTrue(_node2.getAcceptorLearner().getLowWatermark().getSeqNum() == _node3.getAcceptorLearner().getLowWatermark().getSeqNum());
  Assert.assertEquals(1,_node3.getAcceptorLearner().getStats().getRecoveryCycles());
  Assert.assertEquals(0,_node3.getAcceptorLearner().getStats().getActiveAccepts());
  Collection<InetSocketAddress> myNewMembers=new LinkedList<>();
  myNewMembers.addAll(_tport2.getFD().getMembers().getMembers().keySet());
  myNewMembers.add(_tport3.getLocalAddress());
  Assert.assertTrue(_node2.getCore().updateMembership(myNewMembers));
  Thread.sleep(2000);
  Assert.assertTrue(_tport3.getFD().isMember(_tport3.getLocalAddress()));
  myClient.send(new Envelope(myProp),_tport2.getLocalAddress());
  myClient.getNext(10000);
  Thread.sleep(2000);
  Assert.assertTrue(_node2.getAcceptorLearner().getLowWatermark().getSeqNum() == _node3.getAcceptorLearner().getLowWatermark().getSeqNum());
  Assert.assertEquals(1,_node3.getAcceptorLearner().getStats().getRecoveryCycles());
  Assert.assertEquals(1,_node3.getAcceptorLearner().getStats().getActiveAccepts());
  myTransport.terminate();
}

Fixed version (ground truth):
@Test public void intro() throws Exception {
  ClientDispatcher myClient=new ClientDispatcher();
  TransportImpl myTransport=new TransportImpl(null);
  myClient.init(myTransport);
  FDUtil.ensureFD(_tport1.getFD());
  FDUtil.ensureFD(_tport2.getFD());
  _tport1.getFD().pin(_tport1.getFD().getMembers().getMembers().keySet());
  _tport2.getFD().pin(_tport2.getFD().getMembers().getMembers().keySet());
  for (int i=0; i < 5; i++) {
    ByteBuffer myBuffer=ByteBuffer.allocate(4);
    myBuffer.putInt(i);
    Proposal myProp=new Proposal("String_Node_Str",myBuffer.array());
    myClient.send(new Envelope(myProp),_tport2.getLocalAddress());
    VoteOutcome myEv=myClient.getNext(10000);
    Assert.assertFalse((myEv == null));
    Assert.assertTrue(myEv.getResult() == VoteOutcome.Reason.VALUE);
    Assert.assertTrue(myEv.getSeqNum() == i);
  }
  Thread.sleep(2000);
  _node3=new ServerDispatcher(new HowlLogger(_node3Log),Listener.NULL_LISTENER);
  _tport3=new TransportImpl(new FailureDetectorImpl(5000));
  _node3.init(_tport3);
  _node3.getAcceptorLearner().setRecoveryGracePeriod(1000);
  Assert.assertFalse(FDUtil.testFD(_tport3.getFD(),10000));
  Assert.assertFalse(_tport3.getFD().isMember(_tport3.getLocalAddress()));
  ByteBuffer myBuffer=ByteBuffer.allocate(4);
  myBuffer.putInt(67);
  Proposal myProp=new Proposal("String_Node_Str",myBuffer.array());
  myClient.send(new Envelope(myProp),_tport2.getLocalAddress());
  VoteOutcome myMsg=myClient.getNext(10000);
  Thread.sleep(5000);
  Assert.assertTrue(_node2.getAcceptorLearner().getLowWatermark().getSeqNum() == _node3.getAcceptorLearner().getLowWatermark().getSeqNum());
  Assert.assertEquals(1,_node3.getAcceptorLearner().getStats().getRecoveryCycles());
  Assert.assertFalse(_tport3.getFD().isMember(_tport3.getLocalAddress()));
  Assert.assertFalse(_tport2.getFD().isMember(_tport3.getLocalAddress()));
  myClient.send(new Envelope(myProp),_tport2.getLocalAddress());
  myClient.getNext(10000);
  Thread.sleep(2000);
  Assert.assertTrue(_node2.getAcceptorLearner().getLowWatermark().getSeqNum() == _node3.getAcceptorLearner().getLowWatermark().getSeqNum());
  Assert.assertEquals(1,_node3.getAcceptorLearner().getStats().getRecoveryCycles());
  Assert.assertEquals(0,_node3.getAcceptorLearner().getStats().getActiveAccepts());
  Collection<InetSocketAddress> myNewMembers=new LinkedList<>();
  myNewMembers.addAll(_tport2.getFD().getMembers().getMembers().keySet());
  myNewMembers.add(_tport3.getLocalAddress());
  Assert.assertTrue(_node2.getCore().updateMembership(myNewMembers));
  Thread.sleep(2000);
  Assert.assertTrue(_tport3.getFD().isMember(_tport3.getLocalAddress()));
  myClient.send(new Envelope(myProp),_tport2.getLocalAddress());
  myClient.getNext(10000);
  Thread.sleep(2000);
  Assert.assertTrue(_node2.getAcceptorLearner().getLowWatermark().getSeqNum() == _node3.getAcceptorLearner().getLowWatermark().getSeqNum());
  Assert.assertEquals(1,_node3.getAcceptorLearner().getStats().getRecoveryCycles());
  Assert.assertEquals(1,_node3.getAcceptorLearner().getStats().getActiveAccepts());
  myTransport.terminate();
}