I am writing an android app, which is a network client. How can I use a ssl/tls connection ?
Do I only need to add a 's' to 'http' in the url parameter of my HttpPost object instance ?
And how can I keep the session so that I don't have to redo all the initialization part of the ssl protocol between two http post messages ?
First you need read any information about https. It's statements like that "'s' to 'http' in the url parameter" says that you don't understand about it.
I do know what https is, I just don't know how to do it in java. Maybe my formulation wasn't quite perfect, or maybe you just didn't understand my question.
But if we take the browser computer, for example, from the client point of view, adding a 's' is enough to trigger the ssl connexion. For example, https://www.google.com (although in that case there is a redirection, but that's specific to google, I'm sure you can find other examples; that's from the server point of view anyway, it's just a different port).
If my proposed answer wasn't correct, please forget it, and just answer the question: I still would like to know how to perform a ssl connexion in java.
Have you looked at the HttpsURLConnection class?