### Question:
HttpServerFactory implements ServerFactory { @Override public HttpServer createServer(SecurityComponentsProvider securityProvider, String protocol, String host, int port, String serverKey, Toolbox toolbox) { Supplier<? extends Component> parentComponent = toolbox.getUIRegistry().getMainFrameProvider(); SecurityManager securityManager = toolbox.getSecurityManager(); PreferencesRegistry prefsRegistry = toolbox.getPreferencesRegistry(); NetworkConfigurationManager networkConfigurationManager = toolbox.getSystemToolbox().getNetworkConfigurationManager(); ServerToolbox serverTools = ServerToolboxUtils.getServerToolbox(toolbox); HttpClient httpClient = new DefaultHttpClient(); ConfigurerParameters parameters = new ConfigurerParameters(); parameters.setClient(httpClient); parameters.setHost(host); parameters.setParentComponent(parentComponent); parameters.setPort(port); parameters.setPrefsRegistry(prefsRegistry); parameters.setProvider(securityProvider); parameters.setSecurityManager(securityManager); parameters.setServerKey(serverKey); parameters.setNetworkConfigurationManager(networkConfigurationManager); new ProxyConfigurer().configure(parameters); new BasicAuthConfigurer().configure(parameters); new CertificateConfigurer().configure(parameters); new TimeoutsConfigurer().configure(parameters, prefsRegistry, serverTools); new ConnectionPoolConfigurer().configure(httpClient); RequestorProviderImpl provider = new RequestorProviderImpl(httpClient, new HeaderValuesImpl(toolbox.getGeometryRegistry().getRenderingCapabilities().getRendererIdentifier()), toolbox.getEventManager(), toolbox.getSystemToolbox().getNetworkConfigurationManager()); HttpServerImpl server = new HttpServerImpl(host, protocol, provider); return server; }  @Override HttpServer createServer(SecurityComponentsProvider securityProvider, String protocol, String host, int port,
            String serverKey, Toolbox toolbox);  }### Answer:
@Test public void testCreateServer() throws GeneralSecurityException, IOException { final EasyMockSupport support = new EasyMockSupport(); final PreferencesRegistry prefsRegistry = createPrefsRegistry(support); @SuppressWarnings("unchecked") final Supplier<? extends Component> parentProvider = support.createMock(Supplier.class); final SecurityManager securityManager = createSecurityManager(support); final Credentials hostCreds = support.createMock(Credentials.class); final Credentials proxyCreds = support.createMock(Credentials.class); final Toolbox toolbox = createToolbox(support, prefsRegistry, parentProvider, securityManager); final SecurityComponentsProvider provider = createSecurityProvider(support, parentProvider, securityManager, prefsRegistry, hostCreds, proxyCreds); support.replayAll(); final HttpServerFactory factory = new HttpServerFactory(); final HttpServerImpl server = (HttpServerImpl)factory.createServer(provider, ourProtocol, ourHost, ourPort, ourServerKey, toolbox); assertEquals(ourHost, server.getHost()); assertEquals(ourProtocol, server.getProtocol()); final RequestorProvider requestorProvider = server.getRequestProvider(); final BaseRequestor baseRequestor = (BaseRequestor)requestorProvider.getFilePoster(); final HttpClient client = baseRequestor.getClient(); assertEquals(client, ((BaseRequestor)requestorProvider.getPostRequestor()).getClient()); assertEquals(client, ((BaseRequestor)requestorProvider.getRequestor()).getClient()); final HttpClientOptions actualOptions = client.getOptions(); assertEquals(ourConnectTimeout, actualOptions.getConnectTimeout()); assertEquals(ourReadTimeout, actualOptions.getReadTimeout()); final CredentialsProvider credsProvider = actualOptions.getCredentialsProvider(); final Credentials credentials = credsProvider.getCredentials(new AuthenticationScope(ourHost, ourPort)); assertEquals(hostCreds, credentials); assertEquals(ConnectionPoolConfigurer.ourMaxConnections, actualOptions.getMaxConnections()); assertEquals(ConnectionPoolConfigurer.ourConnectionsPerRoute, actualOptions.getMaxConnectionsPerRoute()); final ProxyConfig proxyConfig = actualOptions.getProxyConfig(); final List<ProxyHostConfig> servers = proxyConfig.getProxyResolver() .getProxyServer(new URL(ourProtocol, ourHost, ourPort, "")); assertEquals(1, servers.size()); assertEquals(ourProxyHost, servers.get(0).getHost()); assertEquals(ourProxyPort, servers.get(0).getPort()); assertEquals(proxyCreds, proxyConfig.getCredentials()); assertTrue(client.getOptions().isAllowCircularRedirects()); support.verifyAll(); }