Because I was instructed to ask this issue in my own question I'm doing this here.
To see Original Topic in which I first asked my question (deleted now).
I got stuck with the same Problem and unfortunately the answers of the author aren't helpful.
To introduce my issue a little bit more in detail, I work with a self signed certificate on my Tomcat 8 (v8.0.15) server on the internet with Java 8 (v8.0.25 - JDK). There I host my Java EE Application, which is the backend for my Android Application. The SSL connector of the Tomcat works as it should. When I test the backend with a RESTClient I get the result as expected.
I created the keystore with one certificate:
keytool -genkey -alias tomcat -keystore tomcat.keystore
-storepass MYKEYSTOREPASS -keyalg RSA -keysize 2048 -validity 365
Then I extracted the certificate:
keytool -export -alias tomcat -storepass MYKEYSTOREPASS
-keystore tomcat.keystore -file tomcat.cer
Lastly I created a new Keystore in the BKS format for my Android Application:
keytool -import -alias tomcat -file tomcat.cer -keypass MYKEYSTOREPASS
-keystore tomcat.bks -storetype BKS -storepass MYKEYSTOREPASS
-providerClass org.bouncycastle.jce.provider.BouncyCastleProvider
-providerpath $PATH_TO_BC_LIBRARY/bcprov-jdk16-146.jar
(as mentioned here the "-export" and "-import" parameter are from previous releases but still useable. So you could also know this command parameters as "-exportcert" and "-importcert")
After finishing this steps I tried to connect and everything went fine. But only till I deactivated/left my WLAN connection. Then it did not work any more and brings an "javax.net.ssl.SSLPeerUnverifiedException: No peer certificate".
I really do not understand this behaviour.
To brighten up the android side a little bit more:
I used the classes/library from this tutorial in exact the same way.
If something is missing, just comment and I will bring the infos.
Thanks a lot in advance!