I've been searching a lot, however haven't find any solution. I want to use URL, HttpsUrlConnection instead of deprecated ones (HttpClient, HttpPost, DefaultHttpClient). I have this code below so far:
Note "MyUrl" takes some parameters. See question 2.
URL url = new URL("MyUrl");
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
connection.setDoInput(true);
connection.setDoOutput(true);
connection.setRequestMethod("POST");
/*Here exception occurs!*/
connection.connect();
So, I have 2 problems to solve: (Maybe the 2nd one should be solved 1stly. I have no idea...)
- When I use
connection.someMethod();SSLException occurs. (i.econnection.getResponseCode();)
The Error is :
javax.net.ssl.SSLHandshakeException: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x635cb550: Failure in SSL library, usually a protocol error
- What is alternative way of
List<NameValuePair> & BasicNameValuePair? Those are deprecated as well.
You can use following library for HTTP requests-response
You can use Google-Gson for parsing JSON data