I have my android application talking to the server which is protected by an SSL certificate. Below is the code for that.
final HttpPost httppost = new HttpPost("https://www.myurl.com");
final List<NameValuePair> postlist = Utils.HttpGetToHttpPost(Arguments);
httppost.setEntity(new UrlEncodedFormEntity(postlist));
final HttpResponse response = httpclient.execute(httppost);
Now my question is how do I prevent a MITM attack. How do I ensure that Im talking to myurl.com and not another url.