@Implementation
  protected HttpResponse execute(
      HttpHost httpHost, HttpRequest httpRequest, HttpContext httpContext)
      throws HttpException, IOException {
    if (FakeHttp.getFakeHttpLayer().isInterceptingHttpRequests()) {
      return FakeHttp.getFakeHttpLayer()
          .emulateRequest(httpHost, httpRequest, httpContext, realObject);
    } else {
      FakeHttp.getFakeHttpLayer()
          .addRequestInfo(new HttpRequestInfo(httpRequest, httpHost, httpContext, redirector));
      HttpResponse response = redirector.execute(httpHost, httpRequest, httpContext);

      if (FakeHttp.getFakeHttpLayer().isInterceptingResponseContent()) {
        interceptResponseContent(response);
      }

      FakeHttp.getFakeHttpLayer().addHttpResponse(response);
      return response;
    }
  }
@Test
  public void shouldReturnRequestsByRule_WithCustomRequestMatcher() throws Exception {
    FakeHttp.setDefaultHttpResponse(404, "no such page");

    FakeHttp.addHttpResponseRule(
        request -> request.getRequestLine().getUri().equals("http://matching.uri"),
        new TestHttpResponse(200, "a cheery response body"));

    HttpResponse response = requestDirector.execute(null, new HttpGet("http://matching.uri"), null);
    assertNotNull(response);
    assertThat(response.getStatusLine().getStatusCode()).isEqualTo(200);
    assertThat(getStringContent(response)).isEqualTo("a cheery response body");

    response = requestDirector.execute(null, new HttpGet("http://non-matching.uri"), null);
    assertNotNull(response);
    assertThat(response.getStatusLine().getStatusCode()).isEqualTo(404);
    assertThat(getStringContent(response)).isEqualTo("no such page");
  }