Program: 5308
Project: 5308
Buggy source:
@Override public void messageReceived(final ChannelHandlerContext ctx,MessageEvent event) throws Exception {
  if (channelClosed) {
    return;
  }
  final Channel inboundChannel=event.getChannel();
  Object msg=event.getMessage();
  if (msg instanceof HttpChunk) {
    if (chunkSender == null) {
      throw new HandlerException(HttpResponseStatus.INTERNAL_SERVER_ERROR,"String_Node_Str");
    }
    chunkSender.send(msg);
  }
 else   if (msg instanceof HttpRequest) {
    HttpRequest request=(HttpRequest)msg;
    request=applyProxyRules(request);
    inboundChannel.setReadable(false);
    WrappedDiscoverable discoverable=getDiscoverable(request,(InetSocketAddress)inboundChannel.getLocalAddress());
    MessageSender sender=discoveryLookup.get(discoverable);
    if (sender == null || !sender.isConnected()) {
      InetSocketAddress address=discoverable.getSocketAddress();
      ChannelFuture future=clientBootstrap.connect(address);
      final Channel outboundChannel=future.getChannel();
      outboundChannel.getPipeline().addAfter("String_Node_Str","String_Node_Str",new OutboundHandler(inboundChannel));
      if (Arrays.equals(Constants.Security.SSL_URI_SCHEME.getBytes(),discoverable.getPayload())) {
        SSLContext clientContext=null;
        try {
          clientContext=SSLContext.getInstance("String_Node_Str");
          clientContext.init(null,PermissiveTrustManagerFactory.getTrustManagers(),null);
        }
 catch (        NoSuchAlgorithmException|KeyManagementException e) {
          throw new RuntimeException("String_Node_Str" + "String_Node_Str",e);
        }
        SSLEngine engine=clientContext.createSSLEngine();
        engine.setUseClientMode(true);
        engine.setEnabledProtocols(new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"});
        outboundChannel.getPipeline().addFirst("String_Node_Str",new SslHandler(engine));
        LOG.trace("String_Node_Str");
      }
      sender=new MessageSender(inboundChannel,future);
      discoveryLookup.put(discoverable,sender);
      inboundChannel.setAttachment(outboundChannel);
      outboundChannel.getCloseFuture().addListener(new ChannelFutureListener(){
        @Override public void operationComplete(        ChannelFuture future) throws Exception {
          inboundChannel.getPipeline().execute(new Runnable(){
            @Override public void run(){
              if (outboundChannel.equals(inboundChannel.getAttachment())) {
                closeOnFlush(inboundChannel);
              }
            }
          }
);
        }
      }
);
    }
 else {
      Channel outboundChannel=(Channel)inboundChannel.getAttachment();
      if (outboundChannel != null) {
        outboundChannel.setReadable(true);
      }
    }
    sender.send(request);
    inboundChannel.setReadable(true);
    if (request.isChunked()) {
      chunkSender=sender;
    }
  }
 else {
    super.messageReceived(ctx,event);
  }
}

Fixed version (ground truth):
@Override public void messageReceived(final ChannelHandlerContext ctx,MessageEvent event) throws Exception {
  if (channelClosed) {
    return;
  }
  final Channel inboundChannel=event.getChannel();
  Object msg=event.getMessage();
  if (msg instanceof HttpChunk) {
    if (chunkSender == null) {
      throw new HandlerException(HttpResponseStatus.INTERNAL_SERVER_ERROR,"String_Node_Str");
    }
    chunkSender.send(msg);
  }
 else   if (msg instanceof HttpRequest) {
    HttpRequest request=(HttpRequest)msg;
    request=applyProxyRules(request);
    inboundChannel.setReadable(false);
    WrappedDiscoverable discoverable=getDiscoverable(request,(InetSocketAddress)inboundChannel.getLocalAddress());
    MessageSender sender=discoveryLookup.get(discoverable);
    if (sender == null || !sender.isConnected()) {
      InetSocketAddress address=discoverable.getSocketAddress();
      ChannelFuture future=clientBootstrap.connect(address);
      final Channel outboundChannel=future.getChannel();
      outboundChannel.getPipeline().addAfter("String_Node_Str","String_Node_Str",new OutboundHandler(inboundChannel));
      if (Arrays.equals(Constants.Security.SSL_URI_SCHEME.getBytes(),discoverable.getPayload())) {
        SSLContext clientContext;
        try {
          clientContext=SSLContext.getInstance("String_Node_Str");
          clientContext.init(null,PermissiveTrustManagerFactory.getTrustManagers(),null);
        }
 catch (        NoSuchAlgorithmException|KeyManagementException e) {
          throw new RuntimeException("String_Node_Str" + "String_Node_Str",e);
        }
        SSLEngine engine=clientContext.createSSLEngine();
        engine.setUseClientMode(true);
        engine.setEnabledProtocols(new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"});
        outboundChannel.getPipeline().addFirst("String_Node_Str",new SslHandler(engine));
        LOG.trace("String_Node_Str");
      }
      sender=new MessageSender(inboundChannel,future);
      discoveryLookup.put(discoverable,sender);
      inboundChannel.setAttachment(outboundChannel);
      outboundChannel.getCloseFuture().addListener(new ChannelFutureListener(){
        @Override public void operationComplete(        ChannelFuture future) throws Exception {
          inboundChannel.getPipeline().execute(new Runnable(){
            @Override public void run(){
              if (outboundChannel.equals(inboundChannel.getAttachment())) {
                closeOnFlush(inboundChannel);
              }
            }
          }
);
        }
      }
);
    }
 else {
      Channel outboundChannel=(Channel)inboundChannel.getAttachment();
      if (outboundChannel != null) {
        outboundChannel.setReadable(true);
      }
    }
    sender.send(request);
    inboundChannel.setReadable(true);
    if (request.isChunked()) {
      chunkSender=sender;
    }
  }
 else {
    super.messageReceived(ctx,event);
  }
}