Program: 85765
Project: 85765
Buggy source:
@Test public void basicTimeoutTest() throws Exception {
  final SettableFuture<Void> serverConnection1Open=SettableFuture.create();
  final SettableFuture<Void> clientConnection1Open=SettableFuture.create();
  final SettableFuture<Void> serverConnection1Closed=SettableFuture.create();
  final SettableFuture<Void> clientConnection1Closed=SettableFuture.create();
  final SettableFuture<Void> serverConnection2Open=SettableFuture.create();
  final SettableFuture<Void> clientConnection2Open=SettableFuture.create();
  final SettableFuture<Void> serverConnection2Closed=SettableFuture.create();
  final SettableFuture<Void> clientConnection2Closed=SettableFuture.create();
  NioServer server=new NioServer(new StreamParserFactory(){
    @Override public ProtobufParser getNewParser(    InetAddress inetAddress,    int port){
      return new ProtobufParser<Protos.TwoWayChannelMessage>(new ProtobufParser.Listener<Protos.TwoWayChannelMessage>(){
        @Override public void messageReceived(        ProtobufParser handler,        Protos.TwoWayChannelMessage msg){
          fail.set(true);
        }
        @Override public synchronized void connectionOpen(        ProtobufParser handler){
          if (serverConnection1Open.isDone()) {
            handler.setSocketTimeout(0);
            serverConnection2Open.set(null);
          }
 else           serverConnection1Open.set(null);
        }
        @Override public synchronized void connectionClosed(        ProtobufParser handler){
          if (serverConnection1Closed.isDone()) {
            serverConnection2Closed.set(null);
          }
 else           serverConnection1Closed.set(null);
        }
      }
,Protos.TwoWayChannelMessage.getDefaultInstance(),1000,10);
    }
  }
);
  server.start(new InetSocketAddress("String_Node_Str",4243));
  new NioClient(new InetSocketAddress("String_Node_Str",4243),new ProtobufParser<Protos.TwoWayChannelMessage>(new ProtobufParser.Listener<Protos.TwoWayChannelMessage>(){
    @Override public void messageReceived(    ProtobufParser handler,    Protos.TwoWayChannelMessage msg){
      fail.set(true);
    }
    @Override public void connectionOpen(    ProtobufParser handler){
      clientConnection1Open.set(null);
    }
    @Override public void connectionClosed(    ProtobufParser handler){
      clientConnection1Closed.set(null);
    }
  }
,Protos.TwoWayChannelMessage.getDefaultInstance(),1000,0),0);
  clientConnection1Open.get();
  serverConnection1Open.get();
  Thread.sleep(15);
  assertTrue(clientConnection1Closed.isDone() && serverConnection1Closed.isDone());
  ProtobufParser<Protos.TwoWayChannelMessage> client2Handler=new ProtobufParser<Protos.TwoWayChannelMessage>(new ProtobufParser.Listener<Protos.TwoWayChannelMessage>(){
    @Override public void messageReceived(    ProtobufParser handler,    Protos.TwoWayChannelMessage msg){
      fail.set(true);
    }
    @Override public void connectionOpen(    ProtobufParser handler){
      clientConnection2Open.set(null);
    }
    @Override public void connectionClosed(    ProtobufParser handler){
      clientConnection2Closed.set(null);
    }
  }
,Protos.TwoWayChannelMessage.getDefaultInstance(),1000,0);
  NioClient client2=new NioClient(new InetSocketAddress("String_Node_Str",4243),client2Handler,0);
  clientConnection2Open.get();
  serverConnection2Open.get();
  Thread.sleep(15);
  assertFalse(clientConnection2Closed.isDone() || serverConnection2Closed.isDone());
  client2Handler.setSocketTimeout(10);
  Thread.sleep(15);
  assertTrue(clientConnection2Closed.isDone() && serverConnection2Closed.isDone());
  server.stop();
}

Fixed version (ground truth):
@Test public void basicTimeoutTest() throws Exception {
  final SettableFuture<Void> serverConnection1Open=SettableFuture.create();
  final SettableFuture<Void> clientConnection1Open=SettableFuture.create();
  final SettableFuture<Void> serverConnection1Closed=SettableFuture.create();
  final SettableFuture<Void> clientConnection1Closed=SettableFuture.create();
  final SettableFuture<Void> serverConnection2Open=SettableFuture.create();
  final SettableFuture<Void> clientConnection2Open=SettableFuture.create();
  final SettableFuture<Void> serverConnection2Closed=SettableFuture.create();
  final SettableFuture<Void> clientConnection2Closed=SettableFuture.create();
  NioServer server=new NioServer(new StreamParserFactory(){
    @Override public ProtobufParser getNewParser(    InetAddress inetAddress,    int port){
      return new ProtobufParser<Protos.TwoWayChannelMessage>(new ProtobufParser.Listener<Protos.TwoWayChannelMessage>(){
        @Override public void messageReceived(        ProtobufParser handler,        Protos.TwoWayChannelMessage msg){
          fail.set(true);
        }
        @Override public synchronized void connectionOpen(        ProtobufParser handler){
          if (serverConnection1Open.isDone()) {
            handler.setSocketTimeout(0);
            serverConnection2Open.set(null);
          }
 else           serverConnection1Open.set(null);
        }
        @Override public synchronized void connectionClosed(        ProtobufParser handler){
          if (serverConnection1Closed.isDone()) {
            serverConnection2Closed.set(null);
          }
 else           serverConnection1Closed.set(null);
        }
      }
,Protos.TwoWayChannelMessage.getDefaultInstance(),1000,10);
    }
  }
);
  server.start(new InetSocketAddress("String_Node_Str",4243));
  new NioClient(new InetSocketAddress("String_Node_Str",4243),new ProtobufParser<Protos.TwoWayChannelMessage>(new ProtobufParser.Listener<Protos.TwoWayChannelMessage>(){
    @Override public void messageReceived(    ProtobufParser handler,    Protos.TwoWayChannelMessage msg){
      fail.set(true);
    }
    @Override public void connectionOpen(    ProtobufParser handler){
      clientConnection1Open.set(null);
    }
    @Override public void connectionClosed(    ProtobufParser handler){
      clientConnection1Closed.set(null);
    }
  }
,Protos.TwoWayChannelMessage.getDefaultInstance(),1000,0),0);
  clientConnection1Open.get();
  serverConnection1Open.get();
  long closeDelayStart=System.currentTimeMillis();
  clientConnection1Closed.get();
  serverConnection1Closed.get();
  long closeDelayFinish=System.currentTimeMillis();
  ProtobufParser<Protos.TwoWayChannelMessage> client2Handler=new ProtobufParser<Protos.TwoWayChannelMessage>(new ProtobufParser.Listener<Protos.TwoWayChannelMessage>(){
    @Override public void messageReceived(    ProtobufParser handler,    Protos.TwoWayChannelMessage msg){
      fail.set(true);
    }
    @Override public void connectionOpen(    ProtobufParser handler){
      clientConnection2Open.set(null);
    }
    @Override public void connectionClosed(    ProtobufParser handler){
      clientConnection2Closed.set(null);
    }
  }
,Protos.TwoWayChannelMessage.getDefaultInstance(),1000,0);
  NioClient client2=new NioClient(new InetSocketAddress("String_Node_Str",4243),client2Handler,0);
  clientConnection2Open.get();
  serverConnection2Open.get();
  Thread.sleep((closeDelayFinish - closeDelayStart) * 10);
  assertFalse(clientConnection2Closed.isDone() || serverConnection2Closed.isDone());
  client2Handler.setSocketTimeout(10);
  clientConnection2Closed.get();
  serverConnection2Closed.get();
  server.stop();
}