HttpsServer causes 100% CPU load with curl
I could also reproduce the problem.
There is an infinite loop in SSLStreams.doClosure
- this is definitely a JDK bug.
HttpsServer worked fine in JDK 10, but starts looping in JDK 11. I guess the problem is that HttpsServer implementation has not been adapted to TLS v1.3 half-close policy appeared in JDK 11.
Fortunately, there is a workaround. Add -Djdk.tls.acknowledgeCloseNotify=true
JVM option. With this option HttpsServer will work as expected. See JDK-8208526 for details.