use of org.springframework.http.client.ClientHttpRequestFactory in project spring-boot by spring-projects.
the class RestTemplateBuilderTests method readTimeoutCanBeConfiguredOnNetty4RequestFactory.
@Test
public void readTimeoutCanBeConfiguredOnNetty4RequestFactory() {
ClientHttpRequestFactory requestFactory = this.builder.requestFactory(Netty4ClientHttpRequestFactory.class).setReadTimeout(1234).build().getRequestFactory();
assertThat(ReflectionTestUtils.getField(requestFactory, "readTimeout")).isEqualTo(1234);
}
use of org.springframework.http.client.ClientHttpRequestFactory in project spring-boot by spring-projects.
the class RestTemplateBuilderTests method connectTimeoutCanBeConfiguredOnOkHttp3RequestFactory.
@Test
public void connectTimeoutCanBeConfiguredOnOkHttp3RequestFactory() {
ClientHttpRequestFactory requestFactory = this.builder.requestFactory(OkHttp3ClientHttpRequestFactory.class).setConnectTimeout(1234).build().getRequestFactory();
assertThat(ReflectionTestUtils.getField(ReflectionTestUtils.getField(requestFactory, "client"), "connectTimeout")).isEqualTo(1234);
}
use of org.springframework.http.client.ClientHttpRequestFactory in project spring-boot by spring-projects.
the class RestTemplateBuilderTests method requestFactoryShouldApply.
@Test
public void requestFactoryShouldApply() throws Exception {
ClientHttpRequestFactory requestFactory = mock(ClientHttpRequestFactory.class);
RestTemplate template = this.builder.requestFactory(requestFactory).build();
assertThat(template.getRequestFactory()).isSameAs(requestFactory);
}
use of org.springframework.http.client.ClientHttpRequestFactory in project spring-boot by spring-projects.
the class RestTemplateBuilderTests method connectTimeoutCanBeConfiguredOnHttpComponentsRequestFactory.
@Test
public void connectTimeoutCanBeConfiguredOnHttpComponentsRequestFactory() {
ClientHttpRequestFactory requestFactory = this.builder.requestFactory(HttpComponentsClientHttpRequestFactory.class).setConnectTimeout(1234).build().getRequestFactory();
assertThat(((RequestConfig) ReflectionTestUtils.getField(requestFactory, "requestConfig")).getConnectTimeout()).isEqualTo(1234);
}
use of org.springframework.http.client.ClientHttpRequestFactory in project spring-boot by spring-projects.
the class RestTemplateBuilderTests method readTimeoutCanBeConfiguredOnOkHttp3RequestFactory.
@Test
public void readTimeoutCanBeConfiguredOnOkHttp3RequestFactory() {
ClientHttpRequestFactory requestFactory = this.builder.requestFactory(OkHttp3ClientHttpRequestFactory.class).setReadTimeout(1234).build().getRequestFactory();
assertThat(ReflectionTestUtils.getField(ReflectionTestUtils.getField(requestFactory, "client"), "readTimeout")).isEqualTo(1234);
}
Aggregations