@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);
  }
@Test(dataProvider = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "sendRequestOptions")
  public void testRestLiRemoteInvocationException(SendRequestOption option,
                                                  TimeoutOption timeoutOption,
                                                  ProtocolVersionOption versionOption,
                                                  ProtocolVersion protocolVersion,
                                                  String errorResponseHeaderName,
                                                  ContentType contentType)
      throws ExecutionException, TimeoutException, InterruptedException, RestLiDecodingException
  {
    final int HTTP_CODE = 404;
    final String ERR_MSG = "WHOOPS!";

    RestClient client = mockClient(HTTP_CODE, ERR_MSG, protocolVersion);
    Request<EmptyRecord> request = mockRequest(EmptyRecord.class, versionOption, contentType);
    RequestBuilder<Request<EmptyRecord>> requestBuilder = mockRequestBuilder(request);

    FutureCallback<Response<EmptyRecord>> callback = new FutureCallback<>();
    try
    {
      sendRequest(option, client, request, requestBuilder, callback);
      Long l = timeoutOption._l;
      TimeUnit timeUnit = timeoutOption._timeUnit;
      Response<EmptyRecord> response = l == null ? callback.get() : callback.get(l, timeUnit);
      Assert.fail("Should have thrown");
    }
    catch (ExecutionException e)
    {
      Throwable cause = e.getCause();
      Assert.assertTrue(cause instanceof RemoteInvocationException,
                        "Expected RemoteInvocationException not " + cause.getClass().getName());
      RemoteInvocationException rlre = (RemoteInvocationException)cause;
      Assert.assertTrue(rlre.getMessage().startsWith("Received error " + HTTP_CODE + " from server"));
      Throwable rlCause = rlre.getCause();
      Assert.assertTrue(rlCause instanceof RestException, "Expected RestException not " + rlCause.getClass().getName());
      RestException rle = (RestException) rlCause;
      Assert.assertEquals(ERR_MSG, rle.getResponse().getEntity().asString("UTF-8"));
      Assert.assertEquals(HTTP_CODE, rle.getResponse().getStatus());
    }
  }