Java Code Examples for com.sun.jersey.api.client.Client#setReadTimeout()
The following examples show how to use
com.sun.jersey.api.client.Client#setReadTimeout() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RemoteNiFiUtils.java From localization_nifi with Apache License 2.0 | 5 votes |
private Client getClient(final SSLContext sslContext) { final Client client; if (sslContext == null) { client = WebUtils.createClient(null); } else { client = WebUtils.createClient(null, sslContext); } client.setReadTimeout(READ_TIMEOUT); client.setConnectTimeout(CONNECT_TIMEOUT); return client; }
Example 2
Source File: TestRestClientManager.java From conductor with Apache License 2.0 | 5 votes |
@Test public void clientDefaultsSetWhenRequestedAgain() { Configuration mockConfiguration = Mockito.mock(Configuration.class); Mockito.when(mockConfiguration.getIntProperty(Mockito.eq(RestClientManager.HTTP_TASK_CONNECT_TIMEOUT), Mockito.eq(RestClientManager.DEFAULT_CONNECT_TIMEOUT))).thenReturn(200); Mockito.when(mockConfiguration.getIntProperty(Mockito.eq(RestClientManager.HTTP_TASK_READ_TIMEOUT), Mockito.eq(RestClientManager.DEFAULT_READ_TIMEOUT))).thenReturn(170); RestClientManager clientManager = new RestClientManager(mockConfiguration); Client client = clientManager.getClient(null); client.setReadTimeout(90); client.setConnectTimeout(90); client = clientManager.getClient(null); Assert.assertEquals(client.getProperties().get("com.sun.jersey.client.property.readTimeout"),170); Assert.assertEquals(client.getProperties().get("com.sun.jersey.client.property.connectTimeout"),200); }
Example 3
Source File: RestClientManager.java From conductor with Apache License 2.0 | 4 votes |
public Client getClient(Input input) { Client client = threadLocalClient.get(); client.setReadTimeout(defaultReadTimeout); client.setConnectTimeout(defaultConnectTimeout); return client; }