             (is (true? false) "Expected HTTP connection to HTTPS port to fail")
             (catch EvalFailedException e
               (is (instance? HttpClientException (.. e getCause)))
-              (is (instance? ConnectionClosedException (.. e getCause getCause)))))))
+              (is (ssl-connection-exception? (.. e getCause getCause)))))))
       (testing "Should be able to connect if explicit matching ciphers are configured"
         (let [sc (create-scripting-container-with-ssl-client
                   10080

            (is (true? false) "Expected HTTP connection to HTTPS port to fail")
            (catch EvalFailedException e
              (is (instance? HttpClientException (.. e getCause)))
              (is (instance? SSLHandshakeException (.. e getCause getCause)))))))

      (testing "Can connect via SSLv3 when specified"
        (let [sc (create-scripting-container-with-ssl-client

(def ring-app-with-auth
  (-> ring-app
      (auth/wrap-basic-authentication authenticated?)))

(defn ssl-connection-exception?
  [ex]
  (or
    (instance? ConnectionClosedException ex)
    (instance? SSLHandshakeException ex)
    (and (instance? IOException ex)
         (= "Connection reset by peer" (.getMessage ex)))))

(defn get-http-client-settings
  [options]
