List of usage examples for org.springframework.remoting.httpinvoker HttpComponentsHttpInvokerRequestExecutor HttpComponentsHttpInvokerRequestExecutor
public HttpComponentsHttpInvokerRequestExecutor()
From source file:org.springframework.remoting.httpinvoker.HttpComponentsHttpInvokerRequestExecutorTests.java
@Test public void customizeConnectionTimeout() throws IOException { HttpComponentsHttpInvokerRequestExecutor executor = new HttpComponentsHttpInvokerRequestExecutor(); executor.setConnectTimeout(5000);//from www.java 2 s . com HttpInvokerClientConfiguration config = mockHttpInvokerClientConfiguration("http://fake-service"); HttpPost httpPost = executor.createHttpPost(config); assertEquals(5000, httpPost.getConfig().getConnectTimeout()); }
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 customizeReadTimeout() throws IOException { HttpComponentsHttpInvokerRequestExecutor executor = new HttpComponentsHttpInvokerRequestExecutor(); executor.setReadTimeout(10000);//from w w w .j a va 2 s . c o m HttpInvokerClientConfiguration config = mockHttpInvokerClientConfiguration("http://fake-service"); HttpPost httpPost = executor.createHttpPost(config); assertEquals(10000, httpPost.getConfig().getSocketTimeout()); }
From source file:org.valkyriercp.security.remoting.BasicAuthCommonsHttpInvokerProxyFactoryBean.java
/** * Constructor. Install the default executor. *///from ww w .ja v a 2s. com public BasicAuthCommonsHttpInvokerProxyFactoryBean() { setHttpInvokerRequestExecutor(new HttpComponentsHttpInvokerRequestExecutor()); }
From source file:org.springframework.remoting.httpinvoker.HttpComponentsHttpInvokerRequestExecutorTests.java
@Test public void mergeBasedOnCurrentHttpClient() throws Exception { RequestConfig defaultConfig = RequestConfig.custom().setSocketTimeout(1234).build(); final CloseableHttpClient client = mock(CloseableHttpClient.class, withSettings().extraInterfaces(Configurable.class)); Configurable configurable = (Configurable) client; when(configurable.getConfig()).thenReturn(defaultConfig); HttpComponentsHttpInvokerRequestExecutor executor = new HttpComponentsHttpInvokerRequestExecutor() { @Override//from ww w . ja va 2 s . c om public HttpClient getHttpClient() { return client; } }; executor.setReadTimeout(5000); HttpInvokerClientConfiguration config = mockHttpInvokerClientConfiguration("http://fake-service"); HttpPost httpPost = executor.createHttpPost(config); RequestConfig requestConfig = httpPost.getConfig(); assertEquals(-1, requestConfig.getConnectTimeout()); assertEquals(-1, requestConfig.getConnectionRequestTimeout()); assertEquals(5000, requestConfig.getSocketTimeout()); // Update the Http client so that it returns an updated config RequestConfig updatedDefaultConfig = RequestConfig.custom().setConnectTimeout(1234).build(); when(configurable.getConfig()).thenReturn(updatedDefaultConfig); executor.setReadTimeout(7000); HttpPost httpPost2 = executor.createHttpPost(config); RequestConfig requestConfig2 = httpPost2.getConfig(); assertEquals(1234, requestConfig2.getConnectTimeout()); assertEquals(-1, requestConfig2.getConnectionRequestTimeout()); assertEquals(7000, requestConfig2.getSocketTimeout()); }
From source file:org.openflamingo.web.viz.VizController.java
/** * Remote File System Service ./*from w ww .ja v a 2 s. co m*/ * * @return Remote Workflow Engine Service */ private FileSystemService getFileSystemService(String url) { HttpInvokerProxyFactoryBean factoryBean = new HttpInvokerProxyFactoryBean(); factoryBean.setServiceUrl(url); factoryBean.setServiceInterface(FileSystemService.class); HttpComponentsHttpInvokerRequestExecutor httpInvokerRequestExecutor = new HttpComponentsHttpInvokerRequestExecutor(); factoryBean.setHttpInvokerRequestExecutor(httpInvokerRequestExecutor); factoryBean.afterPropertiesSet(); return (FileSystemService) factoryBean.getObject(); }