Program: 4167
Project: 4167
Buggy source:
public void testHasBufferedOutput() throws Exception {
  Executor executor=ExecutorsHelper.newProcessingQueue("String_Node_Str");
  SSLContext context=SSLContext.getInstance("String_Node_Str");
  context.init(null,null,null);
  final SSLReadWriteChannel clientChannel=new SSLReadWriteChannel(context,executor);
  final SSLReadWriteChannel serverChannel=new SSLReadWriteChannel(context,executor);
  NIODispatcher.instance().getScheduledExecutorService().submit(new Runnable(){
    public void run(){
      clientChannel.initialize(null,new String[]{"String_Node_Str"},true,false);
      serverChannel.initialize(null,new String[]{"String_Node_Str"},false,false);
    }
  }
).get();
  Pipe clientToServer=Pipe.open();
  Pipe serverToClient=Pipe.open();
  serverToClient.source().configureBlocking(false);
  serverToClient.sink().configureBlocking(false);
  clientToServer.source().configureBlocking(false);
  clientToServer.sink().configureBlocking(false);
  IWWrapper clientWriteSink=new IWWrapper(clientToServer.sink());
  clientChannel.setReadChannel(new IRWrapper(serverToClient.source()));
  clientChannel.setWriteChannel(clientWriteSink);
  serverChannel.setReadChannel(new IRWrapper(clientToServer.source()));
  serverChannel.setWriteChannel(new IWWrapper(serverToClient.sink()));
  ByteBuffer buffer=ByteBuffer.wrap("String_Node_Str".getBytes());
  assertFalse(clientChannel.hasBufferedOutput());
  clientChannel.write(buffer);
  assertTrue(clientChannel.hasBufferedOutput());
  clientChannel.handleWrite();
  assertFalse(clientChannel.hasBufferedOutput());
  clientChannel.handleWrite();
  assertFalse(clientChannel.hasBufferedOutput());
  clientChannel.write(ByteBuffer.allocate(0));
  assertFalse(clientChannel.hasBufferedOutput());
  clientWriteSink.hasBufferedOutput=true;
  assertTrue(clientChannel.hasBufferedOutput());
  serverToClient.source().close();
  serverToClient.sink().close();
  clientToServer.source().close();
  clientToServer.sink().close();
  clientChannel.shutdown();
  serverChannel.shutdown();
}

Fixed version (ground truth):
public void testHasBufferedOutput() throws Exception {
  Executor executor=ExecutorsHelper.newProcessingQueue("String_Node_Str");
  SSLContext context=SSLContext.getInstance("String_Node_Str");
  context.init(null,null,null);
  final SSLReadWriteChannel clientChannel=new SSLReadWriteChannel(context,executor,NIODispatcher.instance().getBufferCache(),NIODispatcher.instance().getScheduledExecutorService());
  final SSLReadWriteChannel serverChannel=new SSLReadWriteChannel(context,executor,NIODispatcher.instance().getBufferCache(),NIODispatcher.instance().getScheduledExecutorService());
  NIODispatcher.instance().getScheduledExecutorService().submit(new Runnable(){
    public void run(){
      clientChannel.initialize(null,new String[]{"String_Node_Str"},true,false);
      serverChannel.initialize(null,new String[]{"String_Node_Str"},false,false);
    }
  }
).get();
  Pipe clientToServer=Pipe.open();
  Pipe serverToClient=Pipe.open();
  serverToClient.source().configureBlocking(false);
  serverToClient.sink().configureBlocking(false);
  clientToServer.source().configureBlocking(false);
  clientToServer.sink().configureBlocking(false);
  IWWrapper clientWriteSink=new IWWrapper(clientToServer.sink());
  clientChannel.setReadChannel(new IRWrapper(serverToClient.source()));
  clientChannel.setWriteChannel(clientWriteSink);
  serverChannel.setReadChannel(new IRWrapper(clientToServer.source()));
  serverChannel.setWriteChannel(new IWWrapper(serverToClient.sink()));
  ByteBuffer buffer=ByteBuffer.wrap("String_Node_Str".getBytes());
  assertFalse(clientChannel.hasBufferedOutput());
  clientChannel.write(buffer);
  assertTrue(clientChannel.hasBufferedOutput());
  clientChannel.handleWrite();
  assertFalse(clientChannel.hasBufferedOutput());
  clientChannel.handleWrite();
  assertFalse(clientChannel.hasBufferedOutput());
  clientChannel.write(ByteBuffer.allocate(0));
  assertFalse(clientChannel.hasBufferedOutput());
  clientWriteSink.hasBufferedOutput=true;
  assertTrue(clientChannel.hasBufferedOutput());
  serverToClient.source().close();
  serverToClient.sink().close();
  clientToServer.source().close();
  clientToServer.sink().close();
  clientChannel.shutdown();
  serverChannel.shutdown();
}