How to speed up slow EWS autodiscover with Office 365

Autodiscover is running really slow

I recently made basic digital signage solution for work that enabled me to show all the meetings of the day on a monitor. After a lot of searching and experimenting, everything worked well on my computer, but it did not on my cheap OVH VPS. As I’m using the Java Managed API to connect to Exchange Web Services, with the OpenJDK JRE it didn’t work at all, it kept loading for over ten minutes, just to get a connection error in the end for my SSH connection. And with the Oracle JRE it did sometimes, but with a lot of effort. Sometimes it worked after a minute, other times it kept on loading as long as with OpenJDK installed.