I have created a a rest mockservice using SOAP UI. And I am trying to connect it from my java class. But It is failing with error
Open connection failed: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
sun.security.ssl.InputRecord.handleUnknownRecord(Unknown Source)
sun.security.ssl.InputRecord.read(Unknown Source)
sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
I am not sure where I am going wrong.
Below is the code -
java.net.URL url = new URL(null, address,new sun.net.www.protocol.https.Handler());
connection = (javax.net.ssl.HttpsURLConnection) url.openConnection();
connection.setDoOutput(true);
connection.setRequestProperty("Content-Type", "text/xml");
connection.setRequestMethod("GET");
connection.connect();
And The URL I am trying to connect is - http://localhost:8089