@Override
  public void onRestRequest(RestRequest req,
      RequestContext requestContext,
      Map<String, String> wireAttrs,
      NextFilter<RestRequest, RestResponse> nextFilter)
  {
    disruptRequest(req, requestContext, wireAttrs, nextFilter);
  }
@Test
  public void testRestLatencyDisrupt() throws Exception
  {
    final RequestContext requestContext = new RequestContext();
    requestContext.putLocalAttr(DISRUPT_CONTEXT_KEY, DisruptContexts.delay(REQUEST_LATENCY));

    final DisruptFilter filter = new DisruptFilter(_scheduler, _executor, REQUEST_TIMEOUT, _clock);
    final CountDownLatch latch = new CountDownLatch(1);
    final AtomicBoolean success = new AtomicBoolean(false);
    final NextFilter<RestRequest, RestResponse> next = new NextFilter<RestRequest, RestResponse>()
    {
      @Override
      public void onRequest(RestRequest restRequest, RequestContext requestContext, Map<String, String> wireAttrs)
      {
        success.set(true);
        latch.countDown();
      }

      @Override
      public void onResponse(RestResponse restResponse, RequestContext requestContext,
          Map<String, String> wireAttrs)
      {
        latch.countDown();
      }

      @Override
      public void onError(Throwable ex, RequestContext requestContext, Map<String, String> wireAttrs)
      {
        latch.countDown();
      }
    };

    filter.onRestRequest(new RestRequestBuilder(new URI(URI)).build(), requestContext, Collections.emptyMap(), next);
    Assert.assertTrue(latch.await(TEST_TIMEOUT, TimeUnit.MILLISECONDS), "Missing NextFilter invocation");
    Assert.assertTrue(success.get(), "Unexpected method invocation");
  }