We are moving a service from JDK 10.0.1 to JDK 11. This service communicates using a TLS connection, where the server has a self-signed certificate.
The CA of this certificate has been added to the cacerts of both JVM's.
Using JDK 10, this was enough to be able to use the HttpBuilder API and communicate with this service. When running the same code (with just the changes to move from jdk.incubator.http to java.net.http) to JDK 11, I hit the notorious “java.security.cert.CertificateException: No subject alternative names present” error?
I understand this is easily fixed by creating an HostNameVerifier with a custom implementation, which is then used with HttpsUrlConnection.
But I'd rather stick with the HttpBuilder API if that's possible.