Make sure you have a valid ssl certificate provided by a third party. You can also use a selfsigned certificate, but for dev only. Letsencrypt provides free certificates that can be used in production....
Use keytool to import the certificate to the keystorechain of java.