Program: 93706
Project: 93706
Buggy source:
private void send(String contentType,Object body,Handler<AsyncResult<HttpResponse<T>>> handler){
  Future<HttpClientResponse> responseFuture=Future.<HttpClientResponse>future().setHandler(ar -> {
    if (ar.succeeded()) {
      HttpClientResponse resp=ar.result();
      Future<HttpResponse<T>> fut=Future.future();
      fut.setHandler(handler);
      resp.exceptionHandler(err -> {
        if (!fut.isComplete()) {
          fut.fail(err);
        }
      }
);
      resp.pause();
      codec.create(ar2 -> {
        resp.resume();
        if (ar2.succeeded()) {
          BodyStream<T> stream=ar2.result();
          stream.exceptionHandler(err -> {
            if (!fut.isComplete()) {
              fut.fail(err);
            }
          }
);
          resp.endHandler(v -> {
            if (!fut.isComplete()) {
              stream.end();
              if (stream.result().succeeded()) {
                fut.complete(new HttpResponseImpl<>(resp,null,stream.result().result()));
              }
 else {
                fut.fail(stream.result().cause());
              }
            }
          }
);
          Pump responsePump=Pump.pump(resp,stream);
          responsePump.start();
        }
 else {
          handler.handle(Future.failedFuture(ar2.cause()));
        }
      }
);
    }
 else {
      handler.handle(Future.failedFuture(ar.cause()));
    }
  }
);
  HttpClientRequest req;
  String requestURI;
  if (params != null && params.size() > 0) {
    QueryStringEncoder enc=new QueryStringEncoder(uri);
    params.forEach(param -> {
      enc.addParam(param.getKey(),param.getValue());
    }
);
    requestURI=enc.toString();
  }
 else {
    requestURI=uri;
  }
  if (ssl != options.isSsl()) {
    req=client.request(method,new RequestOptions().setSsl(ssl).setHost(host).setPort(port).setURI(uri));
  }
 else {
    req=client.request(method,port,host,requestURI);
  }
  req.setFollowRedirects(followRedirects);
  if (headers != null) {
    req.headers().addAll(headers);
  }
  req.exceptionHandler(err -> {
    if (!responseFuture.isComplete()) {
      responseFuture.fail(err);
    }
  }
);
  req.handler(resp -> {
    if (!responseFuture.isComplete()) {
      responseFuture.complete(resp);
    }
  }
);
  if (timeout > 0) {
    req.setTimeout(timeout);
  }
  if (body != null) {
    if (contentType != null) {
      String prev=req.headers().get(HttpHeaders.CONTENT_TYPE);
      if (prev == null) {
        req.putHeader(HttpHeaders.CONTENT_TYPE,contentType);
      }
 else {
        contentType=prev;
      }
    }
    if (body instanceof ReadStream<?>) {
      ReadStream<Buffer> stream=(ReadStream<Buffer>)body;
      if (headers == null || !headers.contains(HttpHeaders.CONTENT_LENGTH)) {
        req.setChunked(true);
      }
      Pump pump=Pump.pump(stream,req);
      stream.exceptionHandler(err -> {
        req.reset();
        if (!responseFuture.isComplete()) {
          responseFuture.fail(err);
        }
      }
);
      stream.endHandler(v -> {
        pump.stop();
        req.end();
      }
);
      pump.start();
    }
 else {
      Buffer buffer;
      if (body instanceof Buffer) {
        buffer=(Buffer)body;
      }
 else       if (body instanceof MultiMap) {
        try {
          MultiMap attributes=(MultiMap)body;
          boolean multipart="String_Node_Str".equals(contentType);
          DefaultFullHttpRequest request=new DefaultFullHttpRequest(HttpVersion.HTTP_1_1,io.netty.handler.codec.http.HttpMethod.POST,"String_Node_Str");
          HttpPostRequestEncoder encoder=new HttpPostRequestEncoder(request,multipart);
          for (          Map.Entry<String,String> attribute : attributes) {
            encoder.addBodyAttribute(attribute.getKey(),attribute.getValue());
          }
          encoder.finalizeRequest();
          for (          String headerName : request.headers().names()) {
            req.putHeader(headerName,request.headers().get(headerName));
          }
          if (encoder.isChunked()) {
            buffer=Buffer.buffer();
            while (true) {
              HttpContent chunk=encoder.readChunk(new UnpooledByteBufAllocator(false));
              ByteBuf content=chunk.content();
              if (content.readableBytes() == 0) {
                break;
              }
              buffer.appendBuffer(Buffer.buffer(content));
            }
          }
 else {
            ByteBuf content=request.content();
            buffer=Buffer.buffer(content);
          }
        }
 catch (        Exception e) {
          throw new VertxException(e);
        }
      }
 else       if (body instanceof JsonObject) {
        buffer=Buffer.buffer(((JsonObject)body).encode());
      }
 else {
        buffer=Buffer.buffer(Json.encode(body));
      }
      req.end(buffer);
    }
  }
 else {
    req.end();
  }
}

Fixed version (ground truth):
private void send(String contentType,Object body,Handler<AsyncResult<HttpResponse<T>>> handler){
  Future<HttpClientResponse> responseFuture=Future.<HttpClientResponse>future().setHandler(ar -> {
    if (ar.succeeded()) {
      HttpClientResponse resp=ar.result();
      Future<HttpResponse<T>> fut=Future.future();
      fut.setHandler(handler);
      resp.exceptionHandler(err -> {
        if (!fut.isComplete()) {
          fut.fail(err);
        }
      }
);
      resp.pause();
      codec.create(ar2 -> {
        resp.resume();
        if (ar2.succeeded()) {
          BodyStream<T> stream=ar2.result();
          stream.exceptionHandler(err -> {
            if (!fut.isComplete()) {
              fut.fail(err);
            }
          }
);
          resp.endHandler(v -> {
            if (!fut.isComplete()) {
              stream.end();
              if (stream.result().succeeded()) {
                fut.complete(new HttpResponseImpl<>(resp,null,stream.result().result()));
              }
 else {
                fut.fail(stream.result().cause());
              }
            }
          }
);
          Pump responsePump=Pump.pump(resp,stream);
          responsePump.start();
        }
 else {
          handler.handle(Future.failedFuture(ar2.cause()));
        }
      }
);
    }
 else {
      handler.handle(Future.failedFuture(ar.cause()));
    }
  }
);
  HttpClientRequest req;
  String requestURI;
  if (params != null && params.size() > 0) {
    QueryStringEncoder enc=new QueryStringEncoder(uri);
    params.forEach(param -> {
      enc.addParam(param.getKey(),param.getValue());
    }
);
    requestURI=enc.toString();
  }
 else {
    requestURI=uri;
  }
  if (ssl != options.isSsl()) {
    req=client.request(method,new RequestOptions().setSsl(ssl).setHost(host).setPort(port).setURI(requestURI));
  }
 else {
    req=client.request(method,port,host,requestURI);
  }
  req.setFollowRedirects(followRedirects);
  if (headers != null) {
    req.headers().addAll(headers);
  }
  req.exceptionHandler(err -> {
    if (!responseFuture.isComplete()) {
      responseFuture.fail(err);
    }
  }
);
  req.handler(resp -> {
    if (!responseFuture.isComplete()) {
      responseFuture.complete(resp);
    }
  }
);
  if (timeout > 0) {
    req.setTimeout(timeout);
  }
  if (body != null) {
    if (contentType != null) {
      String prev=req.headers().get(HttpHeaders.CONTENT_TYPE);
      if (prev == null) {
        req.putHeader(HttpHeaders.CONTENT_TYPE,contentType);
      }
 else {
        contentType=prev;
      }
    }
    if (body instanceof ReadStream<?>) {
      ReadStream<Buffer> stream=(ReadStream<Buffer>)body;
      if (headers == null || !headers.contains(HttpHeaders.CONTENT_LENGTH)) {
        req.setChunked(true);
      }
      Pump pump=Pump.pump(stream,req);
      stream.exceptionHandler(err -> {
        req.reset();
        if (!responseFuture.isComplete()) {
          responseFuture.fail(err);
        }
      }
);
      stream.endHandler(v -> {
        pump.stop();
        req.end();
      }
);
      pump.start();
    }
 else {
      Buffer buffer;
      if (body instanceof Buffer) {
        buffer=(Buffer)body;
      }
 else       if (body instanceof MultiMap) {
        try {
          MultiMap attributes=(MultiMap)body;
          boolean multipart="String_Node_Str".equals(contentType);
          DefaultFullHttpRequest request=new DefaultFullHttpRequest(HttpVersion.HTTP_1_1,io.netty.handler.codec.http.HttpMethod.POST,"String_Node_Str");
          HttpPostRequestEncoder encoder=new HttpPostRequestEncoder(request,multipart);
          for (          Map.Entry<String,String> attribute : attributes) {
            encoder.addBodyAttribute(attribute.getKey(),attribute.getValue());
          }
          encoder.finalizeRequest();
          for (          String headerName : request.headers().names()) {
            req.putHeader(headerName,request.headers().get(headerName));
          }
          if (encoder.isChunked()) {
            buffer=Buffer.buffer();
            while (true) {
              HttpContent chunk=encoder.readChunk(new UnpooledByteBufAllocator(false));
              ByteBuf content=chunk.content();
              if (content.readableBytes() == 0) {
                break;
              }
              buffer.appendBuffer(Buffer.buffer(content));
            }
          }
 else {
            ByteBuf content=request.content();
            buffer=Buffer.buffer(content);
          }
        }
 catch (        Exception e) {
          throw new VertxException(e);
        }
      }
 else       if (body instanceof JsonObject) {
        buffer=Buffer.buffer(((JsonObject)body).encode());
      }
 else {
        buffer=Buffer.buffer(Json.encode(body));
      }
      req.end(buffer);
    }
  }
 else {
    req.end();
  }
}