4

We are using Spring boot version 2.3.1 also we use WebClient

My WebClient configuration:

    private val client: WebClient

init {
    val sslCtx = SslContextBuilder
            .forClient()
            .trustManager(InsecureTrustManagerFactory.INSTANCE)
            .build()

    val httpClient = HttpClient.create().secure { it.sslContext(sslCtx) }
    val connector = ReactorClientHttpConnector(httpClient)
    client = WebClient.builder()
            .clientConnector(connector)
            .baseUrl(URL)
            .build()
}

private fun post(formData: MultiValueMap<String, String>, response: Class<out Response>, enableLog: 
Boolean = true): Response? {
    val inserts = BodyInserters.fromFormData(formData)
    return try {
        client
                .post()
                .body(inserts)
                .retrieve()
                .bodyToMono(response)
                .block()
    } catch (e: Exception) {
        if (enableLog) {
            log.error("Failed execute request: $formData", e)
        }
        throw e
    }
}

And when I try to debug my application I have this exception:

javax.net.ssl.SSLException: SSLEngine closed already at io.netty.handler.ssl.SslHandler.wrap(SslHandler.java:848) ~[netty-handler-4.1.50.Final.jar:4.1.50.Final] Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: Error has been observed at the following site(s): |_ checkpoint ⇢ Request to POST null [DefaultWebClient]

Sam Kilanoff
  • 188
  • 2
  • 15

0 Answers0