title: Open connection failed: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
body: <p>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 </p>
  
  <pre><code>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)
  </code></pre>
  
  <p>I am not sure where I am going wrong.</p>
  
  <p>Below is the code - </p>
  
  <pre><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();
  </code></pre>
  
  <p>And The URL I am trying to connect is - <a href="http://localhost:8089" rel="nofollow">http://localhost:8089</a></p>