我正在获得以下异常
DataOutputStream wr = new DataOutputStream(con.getOutputStream());
本声明:
javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
以下是代码:
HttpURLConnection con;
String inputLine;
StringBuffer response=null;
try {
URL obj = new URL(null, url, new sun.net.www.protocol.https.Handler());
con = (HttpURLConnection)obj.openConnection(); //(HttpsURLConnection)
con.setRequestMethod(“POST”);
con.addRequestProperty(“Content-Type”,”application/json”);
for(Map.Entry prop : header.entrySet()) {
con.setRequestProperty(prop.getKey(),prop.getValue());
}
con.setDoOutput(true);
DataOutputStream wr = new DataOutputStream(con.getOutputStream());
wr.writeBytes(postParameters);
wr.flush();
wr.close();
} catch (Exception e) {} finally {}