### Question:
TimeoutsConfigurer { public void configure(ConfigurerParameters parameters, PreferencesRegistry prefsRegistry, ServerToolbox serverTools) { HttpClient client = parameters.getClient(); String host = parameters.getHost(); ServerListManager serverManager = serverTools.getServerLayerListManager(); Collection<ServerConnectionParams> activeServers = serverManager.getActiveServers(); int readTimeout = -1; int connectTimeout = -1; for (ServerConnectionParams activeServer : activeServers) { ServerConfiguration serverConfig = activeServer.getServerConfiguration(); if (host.equals(serverConfig.getHost())) { readTimeout = serverConfig.getReadTimeout(); connectTimeout = serverConfig.getConnectTimeout(); break; } } if (readTimeout <= 0) { readTimeout = ServerConstants.getDefaultServerReadTimeoutFromPrefs(prefsRegistry); } if (connectTimeout <= 0) { connectTimeout = ServerConstants.getDefaultServerConnectTimeoutFromPrefs(prefsRegistry); } client.getOptions().setReadTimeout(readTimeout / 1000); client.getOptions().setConnectTimeout(connectTimeout / 1000); }  void configure(ConfigurerParameters parameters, PreferencesRegistry prefsRegistry, ServerToolbox serverTools);  }### Answer:
@Test public void testConfigureActiveServer() { EasyMockSupport support = new EasyMockSupport(); HttpClientOptions options = new HttpClientOptions(); HttpClient client = createClient(support, options); ServerToolbox serverToolbox = createServerToolbox(support, true); PreferencesRegistry registry = EasyMock.createMock(PreferencesRegistry.class); support.replayAll(); ConfigurerParameters parameters = new ConfigurerParameters(); parameters.setClient(client); parameters.setHost(ourHost); TimeoutsConfigurer configurer = new TimeoutsConfigurer(); configurer.configure(parameters, registry, serverToolbox); assertEquals(ourConnectTimeout, options.getConnectTimeout()); assertEquals(ourReadTimeout, options.getReadTimeout()); support.verifyAll(); }
@Test public void testConfigureNoActiveServer() { EasyMockSupport support = new EasyMockSupport(); HttpClientOptions options = new HttpClientOptions(); HttpClient client = createClient(support, options); ServerToolbox serverToolbox = createServerToolbox(support, false); PreferencesRegistry registry = createPrefsRegistry(support); support.replayAll(); ConfigurerParameters parameters = new ConfigurerParameters(); parameters.setClient(client); parameters.setHost(ourHost); TimeoutsConfigurer configurer = new TimeoutsConfigurer(); configurer.configure(parameters, registry, serverToolbox); assertEquals(ourDefaultConnect, options.getConnectTimeout()); assertEquals(ourDefaultRead, options.getReadTimeout()); support.verifyAll(); }