 (ns puppetlabs.puppetserver.ruby.http-client-test
   (:import (org.jruby.embed EvalFailedException)
-           (org.apache.http ConnectionClosedException)
-           (javax.net.ssl SSLHandshakeException)
+           (org.apache.http ProtocolException ConnectionClosedException)
+           (javax.net.ssl SSLHandshakeException SSLException)
            (java.util HashMap)
            (java.io IOException)
            (java.util.zip GZIPInputStream))

  (or
    (instance? ConnectionClosedException ex)
    (instance? SSLHandshakeException ex)
    (and (instance? IOException ex)
         (= "Connection reset by peer" (.getMessage ex)))))


            (.runScriptlet sc (raise-caught-http-error "$c.get('/', {})"))
            (is false "Expected HTTP connection to HTTPS port to fail")
            (catch EvalFailedException e
              (is (instance? ProtocolException (.getCause e))))))))))

  (testing "Can connect via TLSv1 by default"
    (with-webserver-with-protocols ["TLSv1"] nil
