List of usage examples for org.springframework.remoting.httpinvoker HttpComponentsHttpInvokerRequestExecutor setConnectionRequestTimeout
public void setConnectionRequestTimeout(int connectionRequestTimeout)
From source file:org.springframework.remoting.httpinvoker.HttpComponentsHttpInvokerRequestExecutorTests.java
@Test public void customizeConnectionRequestTimeout() throws IOException { HttpComponentsHttpInvokerRequestExecutor executor = new HttpComponentsHttpInvokerRequestExecutor(); executor.setConnectionRequestTimeout(7000); HttpInvokerClientConfiguration config = mockHttpInvokerClientConfiguration("http://fake-service"); HttpPost httpPost = executor.createHttpPost(config); assertEquals(7000, httpPost.getConfig().getConnectionRequestTimeout()); }
From source file:org.springframework.remoting.httpinvoker.HttpComponentsHttpInvokerRequestExecutorTests.java
@Test public void defaultSettingsOfHttpClientMergedOnExecutorCustomization() throws IOException { RequestConfig defaultConfig = RequestConfig.custom().setConnectTimeout(1234).build(); CloseableHttpClient client = mock(CloseableHttpClient.class, withSettings().extraInterfaces(Configurable.class)); Configurable configurable = (Configurable) client; when(configurable.getConfig()).thenReturn(defaultConfig); HttpComponentsHttpInvokerRequestExecutor executor = new HttpComponentsHttpInvokerRequestExecutor(client); HttpInvokerClientConfiguration config = mockHttpInvokerClientConfiguration("http://fake-service"); HttpPost httpPost = executor.createHttpPost(config); assertSame("Default client configuration is expected", defaultConfig, httpPost.getConfig()); executor.setConnectionRequestTimeout(4567); HttpPost httpPost2 = executor.createHttpPost(config); assertNotNull(httpPost2.getConfig()); assertEquals(4567, httpPost2.getConfig().getConnectionRequestTimeout()); // Default connection timeout merged assertEquals(1234, httpPost2.getConfig().getConnectTimeout()); }