Add HTTPS support for the java target

Closes #2682