@Test
public void createWithOneShouldCreateDefaultHttpClient() throws Exception {

    DefaultHttpClient expected = mock(DefaultHttpClient.class);
    ProxySelectorRoutePlanner planner = mock(ProxySelectorRoutePlanner.class);
    ClientConnectionManager clientConnectionManager = mock(ClientConnectionManager.class);
    SchemeRegistry schemeRegistry = mock(SchemeRegistry.class);
    ProxySelector proxySelector = mock(ProxySelector.class);
    when(expected.getConnectionManager()).thenReturn(clientConnectionManager);
    when(clientConnectionManager.getSchemeRegistry()).thenReturn(schemeRegistry);
    mockStatic(ProxySelector.class);
    when(ProxySelector.getDefault()).thenReturn(proxySelector);
    whenNew(DefaultHttpClient.class).withNoArguments().thenReturn(expected);
    whenNew(ProxySelectorRoutePlanner.class)
            .withArguments(schemeRegistry, proxySelector).thenReturn(planner);
    HttpClient actual = HttpClientFactory.create(crestConfig, getClass());
    assertSame(expected, actual);
    verify(expected).setRoutePlanner(planner);
}