       (and (instance? ContentSource cs)
            (= 8383 (.getPort (.getConnectionProvider cs)))
            (= "localhost" (.getHostName (.getConnectionProvider cs)))))))
+
+;; TODO with SSLContext
+;; (comment
+;;   (session-options (create-session {:uri "xdbc://localhost:8383/"
+;;                                     :user "rest-admin" :password "x"
+;;                                     :content-base "TutorialDB"}
+;;                                    (hosted-content-source "localhost" 8383
+;;                                                           "rest-admin" "x" "TutorialDB"
+;;                                                           (security-options TODO))
+;;                                    {}))
+
+;;   (session-options (create-session {:uri "xdbc://localhost:8383/"
+;;                                     :user "rest-admin" :password "x"
+;;                                     :content-base "TutorialDB"}
+;;                                    (managed-content-source connection-provider ;; TODO implement https://docs.marklogic.com/javadoc/xcc/com/marklogic/xcc/spi/ConnectionProvider.html interface
+;;                                                            "rest-admin" "x" "TutorialDB")
+;;                                    {})))

    (is (= 6000
           (.getTimeoutMillis (request-options {:timeout-millis 6000}))))))

(deftest accept-only-valid-request-options
  (testing "Options that don't exist must raise an error"
    (is (thrown? java.lang.IllegalArgumentException
                 (with-open [sess (create-session db)]
                   (execute-xquery sess "\"hello world\"" {:options {:reuqest-time-limt 500}}))))))



;; TODO a full end-to-end test of all request options

;;;; Session options
(deftest default-session-options
  (testing "A session with no explicitly-set options must have default options"
    (let [sess-opts (session-options (create-session db))]
      (and (is (instance? RequestOptions (:default-request-options sess-opts)))
           (is (instance? RequestOptions (:effective-request-options sess-opts)))
           (is (instance? Logger (:logger sess-opts)))
           (is (nil? (:user-object sess-opts)))
           (is (= 0 (:transaction-timeout sess-opts)))
           (is (nil? (:transaction-mode sess-opts)))))))

(deftest set-session-options
  (testing "A session with explicitly-set options must reflect those options"
    (let [sess-opts (session-options
                     (create-session db
                                     {:default-request-options {:timeout-millis 75}
                                      ;; TODO test user-object
                                      ;; TODO test Logger more deeply
                                      ;; TODO test default Req Opts more?
                                      ;; TODO test effective Req Opts more?
                                      :transaction-timeout 56
                                      :transaction-mode :query}))]
      (and (is (= 75
                  (.getTimeoutMillis (:default-request-options sess-opts))
                  (.getTimeoutMillis (:effective-request-options sess-opts))))
           (is (instance? Logger (:logger sess-opts)))
           (is (empty? (:user-object sess-opts)))
           (is (= 56 (:transaction-timeout sess-opts)))
           (is (= :query (:transaction-mode sess-opts)))))))

;; TODO accept-only-valid-session-options

;; TODO all these session creation approaches
;; (session-options (create-session {:uri "xdbc://localhost:8383/"
;;                                   :user "rest-admin" :password "x"
;;                                   :content-base "TutorialDB"}
;;                                  {} (uri-content-source "xdbc://localhost:8383/")))

;; (comment
;;   (session-options (create-session {:uri "xdbc://localhost:8383/"
;;                                     :user "rest-admin" :password "x"
;;                                     :content-base "TutorialDB"}
;;                                    {} (uri-content-source "xdbc://localhost:8383/"
;;                                                           (security-options TODO)))))

;; (session-options (create-session {:uri "xdbc://localhost:8383/"
;;                                   :user "rest-admin" :password "x"
;;                                   :content-base "TutorialDB"}
;;                                  {} (hosted-content-source "localhost" 8383
;;                                                            "rest-admin" "x" "TutorialDB")))

;; (comment
;;   (session-options (create-session {:uri "xdbc://localhost:8383/"
;;                                     :user "rest-admin" :password "x"
;;                                     :content-base "TutorialDB"}
;;                                    {} (hosted-content-source "localhost" 8383
;;                                                              "rest-admin" "x" "TutorialDB"
;;                                                              (security-options TODO))))

;;   (session-options (create-session {:uri "xdbc://localhost:8383/"
;;                                     :user "rest-admin" :password "x"
;;                                     :content-base "TutorialDB"}
;;                                    {} (managed-content-source connection-provider ;; TODO implement https://docs.marklogic.com/javadoc/xcc/com/marklogic/xcc/spi/ConnectionProvider.html interface
;;                                                               "rest-admin" "x" "TutorialDB"))))


;;;; Content creation options


;;;; Content Source from URI

;; (comment
;;   (session-options (create-session {:uri "xdbc://localhost:8383/"
;;                                     :user "rest-admin" :password "x"
;;                                     :content-base "TutorialDB"}
;;                                    {} (uri-content-source "xdbc://localhost:8383/"
;;                                                           (security-options TODO)))))

(deftest content-source-creation-with-uri
  (testing "content source creation from just a URI"
    (let [cs (make-uri-content-source "xdbc://localhost:8383/")]
