@Override
  public void handleRequest(RestRequest request, RequestContext requestContext, Callback<RestResponse> callback)
  {
    //This code path cannot accept content types or accept types that contain
    //multipart/related. This is because these types of requests will usually have very large payloads and therefore
    //would degrade server performance since RestRequest reads everything into memory.
    if (!isMultipart(request, requestContext, callback))
    {
      _restRestLiServer.handleRequest(request, requestContext, callback);
    }
  }
@Test(dataProvider = "restOrStream")
  public void testSyncNullObject404(final RestOrStream restOrStream) throws Exception
  {
    final StatusCollectionResource statusResource = getMockResource(StatusCollectionResource.class);
    EasyMock.expect(statusResource.get(eq(1L))).andReturn(null).once();
    replay(statusResource);

    Callback<RestResponse> restResponseCallback = new Callback<RestResponse>()
    {
      @Override
      public void onSuccess(RestResponse restResponse)
      {
        fail("We should not get a success here. The server should have returned a 404!");
      }

      @Override
      public void onError(Throwable e)
      {
        RestException restException = (RestException) e;
        assertEquals(restException.getResponse().getStatus(), 404, "We should get a 404 back here!");
        EasyMock.verify(statusResource);
        EasyMock.reset(statusResource);
      }
    };

    if (restOrStream == RestOrStream.REST)
    {
      RestRequest request = new RestRequestBuilder(new URI("/statuses/1"))
          .setHeader(RestConstants.HEADER_RESTLI_PROTOCOL_VERSION, AllProtocolVersions.BASELINE_PROTOCOL_VERSION.toString()).build();

      _server.handleRequest(request, new RequestContext(), restResponseCallback);
    }
    else
    {
      StreamRequest streamRequest = new StreamRequestBuilder(new URI("/statuses/1"))
          .setHeader(RestConstants.HEADER_RESTLI_PROTOCOL_VERSION, AllProtocolVersions.BASELINE_PROTOCOL_VERSION.toString())
          .build(EntityStreams.emptyStream());

      Callback<StreamResponse> callback = new Callback<StreamResponse>()
      {
        @Override
        public void onSuccess(StreamResponse streamResponse)
        {
          fail("We should not get a success here. The server should have returned a 404!");
        }

        @Override
        public void onError(Throwable e)
        {
          Messages.toRestException((StreamException) e, new Callback<RestException>()
          {
            @Override
            public void onError(Throwable e)
            {
              Assert.fail();
            }

            @Override
            public void onSuccess(RestException result)
            {
              restResponseCallback.onError(result);
            }
          });
        }
      };

      _server.handleRequest(streamRequest, new RequestContext(), callback);
    }
  }