@Test
public void usesDifferentWrappersForDifferentHosts() throws Exception {

    Flag f1 = new Flag();
    ServiceWrapper wrapper1 = new NullWrapper(f1);
    Flag f2 = new Flag();
    ServiceWrapper wrapper2 = new NullWrapper(f2);
    HttpUriRequest req1 = new HttpGet("http://foo.example.com/");
    HttpUriRequest req2 = new HttpGet("http://bar.example.com/");
    HttpResponse resp1 = resp;
    HttpResponse resp2 = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
    expect(mockFactory.getWrapperWithName("foo.example.com:80")).andReturn(wrapper1);
    expect(mockFactory.getWrapperWithName("bar.example.com:80")).andReturn(wrapper2);
    expect(mockBackend.execute(isA(HttpHost.class), isA(HttpRequest.class), isA(HttpContext.class)))
        .andReturn(resp1);
    expect(mockBackend.execute(isA(HttpHost.class), isA(HttpRequest.class), isA(HttpContext.class)))
        .andReturn(resp2);
    replayMocks();
    impl.execute(req1, ctx);
    assertTrue(f1.set && !f2.set);
    impl.execute(req2, ctx);
    assertTrue(f1.set && f2.set);
    verifyMocks();
}