Program: 4176
Project: 4176
Buggy source:
public void testParentInterestOffDoesntKillHandshake() 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);
  final IRWrapper clientReadSink=new IRWrapper(serverToClient.source());
  final IWWrapper clientWriteSink=new IWWrapper(clientToServer.sink());
  final IRWrapper serverReadSink=new IRWrapper(clientToServer.source());
  final IWWrapper serverWriteSink=new IWWrapper(serverToClient.sink());
  clientChannel.setReadChannel(clientReadSink);
  clientChannel.setWriteChannel(clientWriteSink);
  serverChannel.setReadChannel(serverReadSink);
  serverChannel.setWriteChannel(serverWriteSink);
  String serverOut="String_Node_Str";
  String clientOut="String_Node_Str";
  final InterestWritableByteChannel serverSource=new WriteBufferChannel(serverOut.getBytes(),serverChannel);
  final InterestWritableByteChannel clientSource=new WriteBufferChannel(clientOut.getBytes(),clientChannel);
  final ByteBuffer clientRead=ByteBuffer.allocate(100);
  final ByteBuffer serverRead=ByteBuffer.allocate(100);
  for (int i=0; i < 10; i++) {
    NIODispatcher.instance().getScheduledExecutorService().submit(new Runnable(){
      public void run(){
        try {
          clientChannel.read(clientRead);
          if (clientReadSink.getLastReadInterest()) {
            clientChannel.interestRead(false);
            assertTrue(clientReadSink.getLastReadInterest());
          }
          serverChannel.read(serverRead);
          if (serverReadSink.getLastReadInterest()) {
            serverChannel.interestRead(false);
            assertTrue(serverReadSink.getLastReadInterest());
          }
          clientChannel.handleWrite();
          if (clientWriteSink.getLastWriteInterest()) {
            clientChannel.interestWrite(null,false);
            assertTrue(clientWriteSink.getLastWriteInterest());
            clientChannel.interestWrite(clientSource,true);
          }
          serverChannel.handleWrite();
          if (serverWriteSink.getLastWriteInterest()) {
            serverChannel.interestWrite(null,false);
            assertTrue(serverWriteSink.getLastWriteInterest());
            serverChannel.interestWrite(serverSource,true);
          }
        }
 catch (        IOException iox) {
          throw new RuntimeException(iox);
        }
      }
    }
).get();
    Thread.sleep(100);
  }
  assertEquals(serverOut,new String(clientRead.array(),0,clientRead.position()));
  assertEquals(clientOut,new String(serverRead.array(),0,serverRead.position()));
  serverToClient.source().close();
  serverToClient.sink().close();
  clientToServer.source().close();
  clientToServer.sink().close();
  clientChannel.shutdown();
  serverChannel.shutdown();
}

Fixed version (ground truth):
public void testParentInterestOffDoesntKillHandshake() 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);
  final IRWrapper clientReadSink=new IRWrapper(serverToClient.source());
  final IWWrapper clientWriteSink=new IWWrapper(clientToServer.sink());
  final IRWrapper serverReadSink=new IRWrapper(clientToServer.source());
  final IWWrapper serverWriteSink=new IWWrapper(serverToClient.sink());
  clientChannel.setReadChannel(clientReadSink);
  clientChannel.setWriteChannel(clientWriteSink);
  serverChannel.setReadChannel(serverReadSink);
  serverChannel.setWriteChannel(serverWriteSink);
  String serverOut="String_Node_Str";
  String clientOut="String_Node_Str";
  final InterestWritableByteChannel serverSource=new WriteBufferChannel(serverOut.getBytes(),serverChannel);
  final InterestWritableByteChannel clientSource=new WriteBufferChannel(clientOut.getBytes(),clientChannel);
  final ByteBuffer clientRead=ByteBuffer.allocate(100);
  final ByteBuffer serverRead=ByteBuffer.allocate(100);
  for (int i=0; i < 10; i++) {
    NIODispatcher.instance().getScheduledExecutorService().submit(new Runnable(){
      public void run(){
        try {
          clientChannel.read(clientRead);
          if (clientReadSink.getLastReadInterest()) {
            clientChannel.interestRead(false);
            assertTrue(clientReadSink.getLastReadInterest());
          }
          serverChannel.read(serverRead);
          if (serverReadSink.getLastReadInterest()) {
            serverChannel.interestRead(false);
            assertTrue(serverReadSink.getLastReadInterest());
          }
          clientChannel.handleWrite();
          if (clientWriteSink.getLastWriteInterest()) {
            clientChannel.interestWrite(null,false);
            assertTrue(clientWriteSink.getLastWriteInterest());
            clientChannel.interestWrite(clientSource,true);
          }
          serverChannel.handleWrite();
          if (serverWriteSink.getLastWriteInterest()) {
            serverChannel.interestWrite(null,false);
            assertTrue(serverWriteSink.getLastWriteInterest());
            serverChannel.interestWrite(serverSource,true);
          }
        }
 catch (        IOException iox) {
          throw new RuntimeException(iox);
        }
      }
    }
).get();
    Thread.sleep(100);
  }
  assertEquals(serverOut,new String(clientRead.array(),0,clientRead.position()));
  assertEquals(clientOut,new String(serverRead.array(),0,serverRead.position()));
  serverToClient.source().close();
  serverToClient.sink().close();
  clientToServer.source().close();
  clientToServer.sink().close();
  clientChannel.shutdown();
  serverChannel.shutdown();
}