 
 (def test-ssl-url (str "https://localhost:" test-ssl-port))
 
-(def test-ssl-options {:port test-port
-                       :ssl? true
-                       :ssl-port test-ssl-port
-                       :keystore (doto (KeyStore/getInstance (KeyStore/getDefaultType))
-                                   (.load nil))
-                       :key-password "hunter2"
-                       :join? nil})
-
-(defn- with-ssl-server [app options f]
-  (let [options (merge test-ssl-options options)]
-    (let [server (run-jetty app options)]
-      (try
-        (f server)
-        (finally (.stop server))))))
+(def nil-keystore
+  (doto (KeyStore/getInstance (KeyStore/getDefaultType)) (.load nil)))
+
+(def test-ssl-options
+  {:port         test-port
+   :ssl?         true
+   :ssl-port     test-ssl-port
+   :keystore     nil-keystore
+   :key-password "hunter2"
+   :join?        false})
 
 (deftest test-run-jetty
   (testing "HTTP server"

              (Thread/sleep 250)
              (recur (inc i))))
          (is (= thread-count (count (all-threads)))))))))

(deftest test-ssl-context-factory
  (testing "excluding cipher suites"
    (let [cipher "SSL_RSA_WITH_NULL_MD5"]
      (with-ssl-server
        echo-handler {:exclude-ciphers [cipher]}
        #(is (contains? (set (.getExcludeCipherSuites (get-ssl-context-factory %))) cipher)))))

  (testing "excluding protocols"
    (let [protocol "SSLv2Hello"]
      (with-ssl-server echo-handler {:exclude-prococols [protocol]}
        #(is (contains? (set (.getExcludeProtocols (get-ssl-context-factory %))) protocol))))))

       (first)
       (.getSslContextFactory)))

(defn- exclude-ciphers [server]
  (set (.getExcludeCipherSuites (get-ssl-context-factory server))))

(defn- exclude-protocols [server]
  (set (.getExcludeProtocols (get-ssl-context-factory server))))

(def test-port (find-free-local-port))

(def test-ssl-port (find-free-local-port))
