             [frereth-cp.server.state :as state]
             [frereth-cp.shared :as shared]
             [frereth-cp.shared.constants :as K]
+            [frereth-cp.shared.serialization :as serial]
+            [frereth-cp.shared.specs :as specs]
             [manifold.stream :as strm]))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;; Helpers
 
 (defn system-options
   []

   ::state/client-read-chan {::state/chan nil}
   ::state/client-write-chan {::state/chan nil}})

(deftest start-stop
  (testing "That we can start and stop successfully"
    (let [inited (build)

    (println "Server should be started now")
    (try
      (println "Sending bogus HELLO")
      (let [msg (build-hello)
            ->srvr (get-in started [::state/client-read-chan ::state/chan])
            success (deref (strm/try-put! ->srvr msg 1000 ::timed-out))]
        (println "put! success:" success)
        (is (not= ::timed-out success))
        (when (not= ::timed-out success)
          (let [srvr-> (get-in started [::state/client-write-chan ::state/chan])
                cookie @(strm/try-take! srvr-> ::drained 1000 ::timeout)]
            (is (not= ::drained cookie))
            (is (not= ::timeout cookie))
            (when (and (not= ::drained cookie)
                       (not= ::timeout cookie))
              ;; A: Decrypt the cookie and send an Initiate to get the server
              ;; to fork a child to handle messages with this client
              (throw (RuntimeException. "Q: What next?"))))))
      (finally
        (println "Triggering event loop exit")
        (stop started)))))
