I had troubles accessing internal Exchange servers using the EWS Java API because of self-signed SSL certificates (and not matching host names), that’s why I created a patch which overrides the existing certificate check and allows all type of SSL certificates.
The code can be found here: https://github.com/hasselbach/ews-java-api
Be aware that this is lowers the security, so you should know what you are doing before using it in productive environments!