### Question:
RequestorProviderImpl implements RequestorProvider { @Override public Pair<String, Integer> resolveProxy(URL destination) { Pair<String, Integer> hostAndPort = null; ProxyHostConfig proxyHost = resolveProxyConfig(destination); if (proxyHost != null) { hostAndPort = new Pair<>(proxyHost.getHost(), Integer.valueOf(proxyHost.getPort())); } return hostAndPort; } RequestorProviderImpl(HttpClient client, HeaderValues headerValues, EventManager eventManager, NetworkConfigurationManager networkConfigurationManager); @Override DeleteRequestor getDeleteRequestor(); @Override FilePostRequestor getFilePoster(); @Override PostRequestor getPostRequestor(); @Override GetRequestor getRequestor(); @Override HeadRequestor getHeadRequestor(); @Override Pair<String, Integer> resolveProxy(URL destination); @Override ProxyHostConfig resolveProxyConfig(URL destination); @Override void setBufferSize(int bufferSize); @Override void setTimeouts(int readTimeout, int connectTimeout); @Override HttpClient getClient();  }### Answer:
@Test public void testResolveProxy() throws IOException { EasyMockSupport support = new EasyMockSupport(); URL testUrl = new URL("http: ProxyResolver resolver = support.createMock(ProxyResolver.class); EasyMock.expect(resolver.getProxyServer(testUrl)) .andReturn(New.list(new ProxyHostConfig(ProxyType.PROXY, "proxyhost", 80))); HttpClientOptions options = new HttpClientOptions(); options.setProxyConfig(new ProxyConfig()); options.getProxyConfig().setProxyResolver(resolver); HttpClient client = support.createMock(HttpClient.class); EasyMock.expect(client.getOptions()).andReturn(options); support.replayAll(); RequestorProviderImpl provider = new RequestorProviderImpl(client, new HeaderConstantsMock(), null, null); Pair<String, Integer> hostAndPort = provider.resolveProxy(testUrl); assertEquals("proxyhost", hostAndPort.getFirstObject()); assertEquals(80, hostAndPort.getSecondObject().intValue()); support.verifyAll(); }
@Test public void testResolveProxyNoProxy() throws MalformedURLException { EasyMockSupport support = new EasyMockSupport(); URL testUrl = new URL("http: HttpClientOptions options = new HttpClientOptions(); HttpClient client = support.createMock(HttpClient.class); EasyMock.expect(client.getOptions()).andReturn(options); support.replayAll(); RequestorProviderImpl provider = new RequestorProviderImpl(client, new HeaderConstantsMock(), null, null); Pair<String, Integer> hostAndPort = provider.resolveProxy(testUrl); assertNull(hostAndPort); support.verifyAll(); }