        (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))


(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))))))

(deftest test-run-jetty
  (testing "HTTP server"

        (let [response (http/get test-url)]
          (is (not (contains? (:headers response) "Server")))))))

  (testing "excluding cipher suites"
    (let [cipher  "SSL_RSA_WITH_NULL_MD5"
          options (assoc test-ssl-options :exclude-ciphers [cipher])
          server  (run-jetty echo-handler options)]
      (try
        (is (contains? (exclude-ciphers server) cipher))
        (finally
          (.stop server)))))

  (testing "excluding cipher protocols"
    (let [protocol "SSLv2Hello"
          options  (assoc test-ssl-options :exclude-protocols [protocol])
          server   (run-jetty echo-handler options)]
      (try
        (is (contains? (exclude-protocols server) protocol))
        (finally
          (.stop server)))))

  ;; Unable to get test working with Jetty 9
  (comment
    (testing "resource cleanup on exception"
