I created a certificate for my Java application with Keytool, that generated a keystore.jks, carets.jks, and server.cer. I imported them inside cacerts.jks and I added the file server.cer also inside Google (Trusted root certificates authorities), but it's always a not secure connection.
I'm a bit confused that I should import the server.cer file in the client (here Google as client) like this or download a certification from Google and import it into cacerts.jks like this answer says. I already inserted there server.cer generated by Keytool inside Google Trusted root certificates authorities and it's always not secure.