Search in sources :

Example 31 with ClientHttpRequestFactory

use of cn.taketoday.http.client.ClientHttpRequestFactory in project today-infrastructure by TAKETODAY.

the class RestTemplateBuilderTests method connectTimeoutCanBeConfiguredOnSimpleRequestFactory.

@Test
void connectTimeoutCanBeConfiguredOnSimpleRequestFactory() {
    ClientHttpRequestFactory requestFactory = this.builder.requestFactory(SimpleClientHttpRequestFactory.class).setConnectTimeout(Duration.ofMillis(1234)).build().getRequestFactory();
    assertThat(requestFactory).hasFieldOrPropertyWithValue("connectTimeout", 1234);
}
Also used : SimpleClientHttpRequestFactory(cn.taketoday.http.client.SimpleClientHttpRequestFactory) InterceptingClientHttpRequestFactory(cn.taketoday.http.client.InterceptingClientHttpRequestFactory) HttpComponentsClientHttpRequestFactory(cn.taketoday.http.client.HttpComponentsClientHttpRequestFactory) OkHttp3ClientHttpRequestFactory(cn.taketoday.http.client.OkHttp3ClientHttpRequestFactory) ClientHttpRequestFactory(cn.taketoday.http.client.ClientHttpRequestFactory) SimpleClientHttpRequestFactory(cn.taketoday.http.client.SimpleClientHttpRequestFactory) BufferingClientHttpRequestFactory(cn.taketoday.http.client.BufferingClientHttpRequestFactory) Test(org.junit.jupiter.api.Test)

Example 32 with ClientHttpRequestFactory

use of cn.taketoday.http.client.ClientHttpRequestFactory in project today-infrastructure by TAKETODAY.

the class RestTemplateBuilderTests method readTimeoutCanBeConfiguredOnOkHttp3RequestFactory.

@Test
void readTimeoutCanBeConfiguredOnOkHttp3RequestFactory() {
    ClientHttpRequestFactory requestFactory = this.builder.requestFactory(OkHttp3ClientHttpRequestFactory.class).setReadTimeout(Duration.ofMillis(1234)).build().getRequestFactory();
    assertThat(requestFactory).isInstanceOf(OkHttp3ClientHttpRequestFactory.class);
    assertThat(requestFactory).extracting("client").extracting("readTimeoutMillis").isEqualTo(1234);
}
Also used : OkHttp3ClientHttpRequestFactory(cn.taketoday.http.client.OkHttp3ClientHttpRequestFactory) InterceptingClientHttpRequestFactory(cn.taketoday.http.client.InterceptingClientHttpRequestFactory) HttpComponentsClientHttpRequestFactory(cn.taketoday.http.client.HttpComponentsClientHttpRequestFactory) OkHttp3ClientHttpRequestFactory(cn.taketoday.http.client.OkHttp3ClientHttpRequestFactory) ClientHttpRequestFactory(cn.taketoday.http.client.ClientHttpRequestFactory) SimpleClientHttpRequestFactory(cn.taketoday.http.client.SimpleClientHttpRequestFactory) BufferingClientHttpRequestFactory(cn.taketoday.http.client.BufferingClientHttpRequestFactory) Test(org.junit.jupiter.api.Test)

Aggregations

ClientHttpRequestFactory (cn.taketoday.http.client.ClientHttpRequestFactory)32 OkHttp3ClientHttpRequestFactory (cn.taketoday.http.client.OkHttp3ClientHttpRequestFactory)28 Test (org.junit.jupiter.api.Test)28 HttpComponentsClientHttpRequestFactory (cn.taketoday.http.client.HttpComponentsClientHttpRequestFactory)26 InterceptingClientHttpRequestFactory (cn.taketoday.http.client.InterceptingClientHttpRequestFactory)26 SimpleClientHttpRequestFactory (cn.taketoday.http.client.SimpleClientHttpRequestFactory)26 BufferingClientHttpRequestFactory (cn.taketoday.http.client.BufferingClientHttpRequestFactory)24 RequestConfig (org.apache.http.client.config.RequestConfig)6 RestTemplate (cn.taketoday.web.client.RestTemplate)4 OkHttpClient (okhttp3.OkHttpClient)4 HttpHeaders (cn.taketoday.http.HttpHeaders)2 HttpMethod (cn.taketoday.http.HttpMethod)2 MediaType (cn.taketoday.http.MediaType)2 ClientHttpRequest (cn.taketoday.http.client.ClientHttpRequest)2 ClientHttpRequestInitializer (cn.taketoday.http.client.ClientHttpRequestInitializer)2 ClientHttpRequestInterceptor (cn.taketoday.http.client.ClientHttpRequestInterceptor)2 HttpMessageConverter (cn.taketoday.http.converter.HttpMessageConverter)2 ResourceHttpMessageConverter (cn.taketoday.http.converter.ResourceHttpMessageConverter)2 StringHttpMessageConverter (cn.taketoday.http.converter.StringHttpMessageConverter)2 ReflectionTestUtils (cn.taketoday.util.ReflectionTestUtils)2