code: protected Response getResponse(HttpEntity entity, RequestBuilder req) {
          CloseableHttpClient client = getClient();
          initHeaders(req);
          req.setEntity(entity);
          CloseableHttpResponse resp = null;
          Response response = null;
          try {
              final HttpUriRequest uriRequest = req.build();
              resp = client.execute(uriRequest);
              response = new Response(resp);
              response.setMethod(Methods.POST.getMethod());
              response.setRequestLine(uriRequest.getRequestLine().toString());
          } catch (Exception e) {
              // TODO: log the error
              e.printStackTrace();
          } finally {
              try {
                  client.close();
              } catch (IOException e) {
                  e.printStackTrace();
              }
          }
          return response;
      }
docs: get response from preconfigured http entity and request builder
  @param entity : http entity to be used in request
  @param req    : request builder object to build the http request
  @return  : Response object prepared after executing the request