I am using springboot webclient to call rest api from remote server. First request works fine. If I made subsequent request after sometime, the server throws 500 server error. The error I got is " onError(java.io.IOException: An existing connection was forcibly closed by the remote host)".
I want to test the behavior with disabling connection pool since I believe it uses the previous connection. Can you help me how to disable the connection pool when creating webclient?
TcpClient tcpClient = TcpClient.create()
.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 30000)
.option(ChannelOption.SO_KEEPALIVE, false)
.doOnConnected(connection ->
connection.addHandlerLast(new ReadTimeoutHandler(30))
.addHandlerLast(new WriteTimeoutHandler(30))
);
ReactorClientHttpConnector httpConnector = new ReactorClientHttpConnector(HttpClient.from(tcpClient));
final WebClient webClient = WebClient
.builder()
.clientConnector(httpConnector)
.baseUrl("http://customer.service.api.internal.cloud.qa.intranet.pagseguro.uol")
.exchangeStrategies(strategies)
.build()