Program: 165
Project: 165
Buggy source:
private final static <T>void executeRequest(final Channel channel,final AsyncHttpClientConfig config,final NettyResponseFuture<T> future,final HttpRequest nettyRequest) throws ConnectException {
  if (!channel.isConnected()) {
    String url=channel.getRemoteAddress() != null ? channel.getRemoteAddress().toString() : null;
    if (url == null) {
      try {
        url=future.getURI().toString();
      }
 catch (      MalformedURLException e) {
      }
    }
    throw new ConnectException(String.format("String_Node_Str",url));
  }
  channel.getPipeline().getContext(NettyAsyncHttpProvider.class).setAttachment(future);
  channel.write(nettyRequest).addListener(new ProgressListener(true,future.getAsyncHandler()));
  if (future.getRequest().getFile() != null) {
    final File file=future.getRequest().getFile();
    RandomAccessFile raf;
    long fileLength=0;
    try {
      raf=new RandomAccessFile(file,"String_Node_Str");
      fileLength=raf.length();
      ChannelFuture writeFuture;
      if (channel.getPipeline().get(SslHandler.class) != null) {
        writeFuture=channel.write(new ChunkedFile(raf,0,fileLength,8192));
        writeFuture.addListener(new ProgressListener(false,future.getAsyncHandler()));
      }
 else {
        final FileRegion region=new DefaultFileRegion(raf.getChannel(),0,fileLength);
        writeFuture=channel.write(region);
        writeFuture.addListener(new ProgressListener(false,future.getAsyncHandler()){
          public void operationComplete(          ChannelFuture cf){
            region.releaseExternalResources();
            super.operationComplete(cf);
          }
        }
);
      }
    }
 catch (    IOException ex) {
      throw new IllegalStateException(ex);
    }
  }
  try {
    future.setReaperFuture(config.reaper().schedule(new Callable<Object>(){
      public Object call(){
        if (!future.isDone() && !future.isCancelled()) {
          future.abort(new TimeoutException());
          channel.getPipeline().getContext(NettyAsyncHttpProvider.class).setAttachment(ClosedEvent.class);
        }
        return null;
      }
    }
,config.getRequestTimeoutInMs(),TimeUnit.MILLISECONDS));
  }
 catch (  RejectedExecutionException ex) {
    future.abort(ex);
  }
}

Fixed version (ground truth):
private final static <T>void executeRequest(final Channel channel,final AsyncHttpClientConfig config,final NettyResponseFuture<T> future,final HttpRequest nettyRequest) throws ConnectException {
  if (!channel.isConnected()) {
    String url=channel.getRemoteAddress() != null ? channel.getRemoteAddress().toString() : null;
    if (url == null) {
      try {
        url=future.getURI().toString();
      }
 catch (      MalformedURLException e) {
      }
    }
    throw new ConnectException(String.format("String_Node_Str",url));
  }
  channel.getPipeline().getContext(NettyAsyncHttpProvider.class).setAttachment(future);
  channel.write(nettyRequest).addListener(new ProgressListener(true,future.getAsyncHandler()));
  if (future.getRequest().getFile() != null) {
    final File file=future.getRequest().getFile();
    RandomAccessFile raf;
    long fileLength=0;
    try {
      raf=new RandomAccessFile(file,"String_Node_Str");
      fileLength=raf.length();
      ChannelFuture writeFuture;
      if (channel.getPipeline().get(SslHandler.class) != null) {
        writeFuture=channel.write(new ChunkedFile(raf,0,fileLength,8192));
        writeFuture.addListener(new ProgressListener(false,future.getAsyncHandler()));
      }
 else {
        final FileRegion region=new DefaultFileRegion(raf.getChannel(),0,fileLength);
        writeFuture=channel.write(region);
        writeFuture.addListener(new ProgressListener(false,future.getAsyncHandler()){
          public void operationComplete(          ChannelFuture cf){
            region.releaseExternalResources();
            super.operationComplete(cf);
          }
        }
);
      }
    }
 catch (    IOException ex) {
      throw new IllegalStateException(ex);
    }
  }
  try {
    future.setReaperFuture(config.reaper().schedule(new Callable<Object>(){
      public Object call(){
        if (!future.isDone() && !future.isCancelled()) {
          future.abort(new TimeoutException("String_Node_Str"));
          channel.getPipeline().getContext(NettyAsyncHttpProvider.class).setAttachment(ClosedEvent.class);
        }
        return null;
      }
    }
,requestTimeout(config,future.getRequest().getPerRequestConfig()),TimeUnit.MILLISECONDS));
  }
 catch (  RejectedExecutionException ex) {
    future.abort(ex);
  }
}