Allow insecure HTTPS connection for Java JDK 11 HttpClient
问题 Sometimes it is needed to allow insecure HTTPS connections, e.g. in some web-crawling applications which should work with any site. I used one such solution with old HttpsURLConnection API which was recently superseded by the new HttpClient API in JDK 11. What is the way to allow insecure HTTPS connections (self-signed or expired certificate) with this new API? UPD: The code I tried (in Kotlin but maps directly to Java): val trustAllCerts = arrayOf<TrustManager>(object: X509TrustManager {