@Override
  public <T> ResponseFuture<T> sendRequest(Request<T> request, RequestContext requestContext)
  {
    FutureCallback<Response<T>> callback = new FutureCallback<>();
    sendRequest(request, requestContext, callback);
    return new ResponseFutureImpl<>(callback);
  }
@SuppressWarnings("deprecation")
  @Test(dataProvider = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "sendRequestAndGetResponseOptions")
  public void testRestLiResponseExceptionFuture(SendRequestOption sendRequestOption,
                                                GetResponseOption getResponseOption,
                                                TimeoutOption timeoutOption,
                                                ProtocolVersionOption versionOption,
                                                ProtocolVersion protocolVersion,
                                                String errorResponseHeaderName,
                                                ContentType contentType)
    throws RemoteInvocationException, TimeoutException, InterruptedException, IOException
  {
    final String ERR_KEY = "someErr";
    final String ERR_VALUE = "WHOOPS!";
    final String ERR_MSG = "whoops2";
    final int HTTP_CODE = 400;
    final int APP_CODE = 666;
    final String CODE = "INVALID_INPUT";
    final String DOC_URL = "https://example.com/errors/invalid-input";
    final String REQUEST_ID = "abc123";

    RestClient client = mockClient(ERR_KEY, ERR_VALUE, ERR_MSG, HTTP_CODE, APP_CODE, CODE, DOC_URL, REQUEST_ID,
        protocolVersion, errorResponseHeaderName);
    Request<EmptyRecord> request = mockRequest(EmptyRecord.class, versionOption, contentType);
    RequestBuilder<Request<EmptyRecord>> requestBuilder = mockRequestBuilder(request);

    ResponseFuture<EmptyRecord> future = sendRequest(sendRequestOption,
                                                     determineErrorHandlingBehavior(getResponseOption),
                                                     client,
                                                     request,
                                                     requestBuilder);
    RestLiResponseException e = getErrorResponse(getResponseOption, future, timeoutOption);

    if (getResponseOption == GetResponseOption.GET_RESPONSE_ENTITY_EXPLICIT_NO_THROW)
    {
      Assert.assertNull(e);
    }
    else
    {
      Assert.assertEquals(HTTP_CODE, e.getStatus());
      Assert.assertEquals(ERR_VALUE, e.getErrorDetails().get(ERR_KEY));
      Assert.assertEquals(APP_CODE, e.getServiceErrorCode());
      Assert.assertEquals(ERR_MSG, e.getServiceErrorMessage());
      Assert.assertEquals(CODE, e.getCode());
      Assert.assertEquals(DOC_URL, e.getDocUrl());
      Assert.assertEquals(REQUEST_ID, e.getRequestId());
      Assert.assertEquals(EmptyRecord.class.getCanonicalName(), e.getErrorDetailType());
      Assert.assertNotNull(e.getErrorDetailsRecord());
      Assert.assertTrue(e.getErrorDetailsRecord() instanceof EmptyRecord);
    }
  }