title: How to made SSL connection for MarkLogic 7?
body: <p>I want to make a SSL connection as given on this <code>http://docs.marklogic.com/guide/admin/SSL</code></p>
  
  <p>But I'm getting the following exception:</p>
  
  <blockquote>
    <p>Exception in thread "main"
    com.marklogic.xcc.exceptions.ServerConnectionException: Unrecognized
    SSL message, plaintext connection?  [Session: user=demo, cb=Arg
    [ContentSource: user=demo, cb=Arg [provider: SSLconn
    address=localhost/127.0.0.1:9470, pool=0/64]]]  [Client: XCC/7.0-2]
      at
    com.marklogic.xcc.impl.handlers.AbstractRequestController.runRequest(AbstractRequestController.java:124)
      at
    com.marklogic.xcc.impl.SessionImpl.submitRequestInternal(SessionImpl.java:388)
      at
    com.marklogic.xcc.impl.SessionImpl.submitRequest(SessionImpl.java:371)
      at com.demoe2.MarklogicDemo.main(MarklogicDemo.java:41) Caused by:
    javax.net.ssl.SSLException: Unrecognized SSL message, plaintext
    connection?   at
    sun.security.ssl.EngineInputRecord.bytesInCompletePacket(Unknown
    Source)   at sun.security.ssl.SSLEngineImpl.readNetRecord(Unknown
    Source)   at sun.security.ssl.SSLEngineImpl.unwrap(Unknown Source</p>
  </blockquote>
  
  <p>My source code is for Java </p>
  
  <pre><code>public class MarklogicDemo {
  
    public static void main(String[] args) throws Exception {
      URI uri = new URI("xcc://demo:password@localhost:9470/Arg");
      query = "for $x in cts:search(//PLAY,cts:element-word-query(xs:QName(\"LINE\"),\"King\")) return ($x//TITLE)";    
      ContentSource con = 
        ContentSourceFactory.newContentSource(
          "localhost", 9470,
          "demo", "password",
          "Arg", newTrustOptions());
      Session see = con.newSession();
      Request req = see.newAdhocQuery(query);
      ResultSequence rs = see.submitRequest (req);
      System.out.println (rs.asString());
      see.close();
    }
  
    protected static SecurityOptions newTrustOptions() throws Exception {
      TrustManager[] trust = 
        new TrustManager[] { 
          new X509TrustManager() {
            public void checkClientTrusted(
              X509Certificate[] x509Certificates, 
              String s) throws CertificateException {
            }
  
            public void checkServerTrusted(
              X509Certificate[] x509Certificates, 
              String s) throws CertificateException {
            }   
            public X509Certificate[] getAcceptedIssuers() {
              return null;
            }
          }
      };
      SSLContext sslContext = SSLContext.getInstance("SSLv3");
      sslContext.init(null, trust, null);
      return new SecurityOptions(sslContext);
    }
  
  }
  </code></pre>