Closed
Description
Joaquim Pedro Silveira opened SPR-14744 and commented
As title describes, when trying to use AsyncRestTemplate with a Netty4ClientHttpRequestFactory, the client is not properly configured by default for https servers.
I also tried with the following code, which results in an HttpClientErrorException
:
@Test
public void asyncRestNetty() throws Exception {
final CountDownLatch latch = new CountDownLatch(1);
AsyncRestTemplate restTemplate = new AsyncRestTemplate(new Netty4ClientHttpRequestFactory());
// the client should send a request to an HTTPS server
ListenableFuture<ResponseEntity<String>> listenableFuture = restTemplate.getForEntity("https://example.org/some/resource", String.class);
listenableFuture.addCallback((result) -> {
latch.countDown();
assertThat(result, is(notNullValue()));
assertThat(result.getBody(), is(not(isEmptyOrNullString())));
}, (throwable) -> {
latch.countDown();
fail(throwable.getMessage());
});
if (!latch.await(30, TimeUnit.SECONDS)) {
fail("Timeout");
}
}
Affects: 4.3.3
Reference URL: http://stackoverflow.com/questions/39639467/spring-resttemplate-asyncresttemplate-with-netty4-hangs-forever
Issue Links:
- RestTemplate POST and PUT don't work with Netty4ClientHttpRequestFactory [SPR-14860] #19426 RestTemplate POST and PUT don't work with Netty4ClientHttpRequestFactory
- Netty4ClientHttpRequestFactory should use SSL if port is 443 or scheme is https [SPR-14889] #19455 Netty4ClientHttpRequestFactory should use SSL if port is 443 or scheme is https
- Netty4ClientHttpRequestFactory should use SNI for TLS connections [SPR-15101] #19668 Netty4ClientHttpRequestFactory should use SNI for TLS connections