@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 testDebugRequestHandlers(final RestOrStream restOrStream) throws URISyntaxException
  {
    //Without a resource
    final Callback<RestResponse> noResourceRestResponseCallback = new Callback<RestResponse>()
    {
      @Override
      public void onSuccess(RestResponse restResponse)
      {
        assertEquals(restResponse.getStatus(), 200);
        String responseString = restResponse.getEntity().asString(Charset.defaultCharset());
        Assert.assertEquals(responseString, DEBUG_HANDLER_RESPONSE_A);
      }

      @Override
      public void onError(Throwable e)
      {
        fail();
      }
    };

    if (restOrStream == RestOrStream.REST)
    {
      RestRequest request = new RestRequestBuilder(new URI("/statuses/1/__debug/a/s")).build();

      _server.handleRequest(request, new RequestContext(), noResourceRestResponseCallback);
    }
    else
    {
      StreamRequest request = new StreamRequestBuilder(new URI("/statuses/1/__debug/a/s")).build(EntityStreams.emptyStream());

      Callback<StreamResponse> callback = new Callback<StreamResponse>()
      {
        @Override
        public void onSuccess(StreamResponse streamResponse)
        {
          Messages.toRestResponse(streamResponse, new Callback<RestResponse>()
          {
            @Override
            public void onError(Throwable e)
            {
              Assert.fail();
            }

            @Override
            public void onSuccess(RestResponse result)
            {
              noResourceRestResponseCallback.onSuccess(result);
            }
          });
        }

        @Override
        public void onError(Throwable e)
        {
          fail();
        }
      };

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


    //With a resource this time
    final StatusCollectionResource statusResource = getMockResource(StatusCollectionResource.class);
    EasyMock.expect(statusResource.get(eq(1L))).andReturn(buildStatusRecord()).once();
    replay(statusResource);

    final Callback<RestResponse> resourceRestResponseCallback = new Callback<RestResponse>()
    {
      @Override
      public void onSuccess(RestResponse restResponse)
      {
        assertEquals(restResponse.getStatus(), 200);
        String responseString = restResponse.getEntity().asString(Charset.defaultCharset());
        Assert.assertEquals(responseString, DEBUG_HANDLER_RESPONSE_B);

        EasyMock.verify(statusResource);
        EasyMock.reset(statusResource);
      }

      @Override
      public void onError(Throwable e)
      {
        fail();
      }
    };

    if (restOrStream == RestOrStream.REST)
    {
      RestRequest request = new RestRequestBuilder(new URI("/statuses/1/__debug/b")).build();

      _server.handleRequest(request, new RequestContext(), resourceRestResponseCallback);
    }
    else
    {
      StreamRequest request = new StreamRequestBuilder(new URI("/statuses/1/__debug/b")).build(EntityStreams.emptyStream());

      Callback<StreamResponse> callback = new Callback<StreamResponse>()
      {
        @Override
        public void onSuccess(StreamResponse streamResponse)
        {
          Messages.toRestResponse(streamResponse, new Callback<RestResponse>()
          {
            @Override
            public void onError(Throwable e)
            {
              Assert.fail();
            }

            @Override
            public void onSuccess(RestResponse result)
            {
              resourceRestResponseCallback.onSuccess(result);
            }
          });
        }

        @Override
        public void onError(Throwable e)
        {
          fail();
        }
      };

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