class GenericCommand extends HystrixCommand<T> {

    @Override
    protected T run() throws Exception {
        final HttpRequestBase request = httpCall.get();
        addCommandHeaders(request); // insert all the provided headers in the request
        addAuthorizationHeaders(request); // update request header with security token
        addLocaleHeaders(request); // Forward locale to target
        final Span requestSpan = addTrackingHeaders(request); // Inject tracing stuff

        try {
            final HttpResponse response;
            try {
                LOGGER.trace("Requesting {} {}", request.getMethod(), request.getURI());
                response = client.execute(request);
            } catch (Exception e) {
                throw onError.apply(e);
            }
            commandResponseHeaders = response.getAllHeaders();

            status = HttpStatus.valueOf(response.getStatusLine().getStatusCode());

            Header cookies = response.getFirstHeader("Set-Cookie");
            if (cookies != null) {
                LOGGER.warn(
                        "request {} {}: Cookie detected in responseHeaders (check security.oauth2.resource.uri settings)",
                        request.getMethod(), request.getURI());
            }

            // do we have a behavior for this status code (even an error) ?
            // if yes use it
            BiFunction<HttpRequestBase, HttpResponse, T> function = behavior.get(status);
            if (function != null) {
                try {
                    return function.apply(request, response);
                } catch (Exception e) {
                    throw onError.apply(e);
                }
            }

            // handle response's HTTP status
            if (status.is4xxClientError() || status.is5xxServerError()) {
                LOGGER.debug("request {} {} : response on error {}", request.getMethod(), request.getURI(),
                        response.getStatusLine());
                // Http status >= 400 so apply onError behavior
                return callOnError(onError).apply(request, response);
            } else {
                // Http status is not error so apply onError behavior
                return behavior.getOrDefault(status, missingBehavior()).apply(request, response);
            }
        } finally {
            tracer.close(requestSpan);
        }
    }

    protected  GenericCommand(final HystrixCommandGroupKey group);
    protected  GenericCommand(final HystrixCommandGroupKey group, final Map<String, String> headers);

}