   (.close (:socket srv-sock))
   (.close (:socket cl-sock)))
 
+(defn blank-msg []
+  (HydraMsg. 0))
+
 (defn server-client-comm [cl-sock srv srv-sock cl-msg & args]
   (apply cl-msg cl-sock args)
   (server/match-msg srv (msg/recv srv-sock))


(def dummy-backend
  (reify server/HydraServerBackend
    (get-latest-post [this]
      "dummy-post-id")
    (get-single-post [this post-id]
      (when (= "dummy-post-id" post-id)
        ["dummy-post-id" "none" "none" "tag_2" 123123123 "dummy" "dummy-post"]))
    (get-all-tags [this]
      "tag_1 tag_2 tag_3 tag_4")
    (get-single-tag [this tag-id]
      (when (= tag-id "tag_1")
        [tag-id "dummy-post-id-2"]))))

(defn setup [& [connect?]]
  (let [srv-sock (msg/server-socket test-endpoint)

(deftest test-get-post-ok
  (let [[cl-sock srv-sock srv] (setup :connected)]
    (try
      (let [post-id "dummy-post-id"
            response (server-client-comm cl-sock srv srv-sock msg/get-post post-id)
            expected (blank-msg)]
        (server/get-single-post dummy-backend expected post-id)
        (is (= HydraMsg/GET_POST_OK
               (.id response)))
        (is (= post-id
               (.post_id response)))
        (is (= (.reply_to expected)
               (.reply_to response)))
        (is (= (.previous expected)
               (.previous response)))
        (is (= (.tags expected)
               (.tags response)))
        (is (= (.timestamp expected)
               (.timestamp response)))
        (is (= (.type expected)
               (.type response)))
        (is (= (.content expected)
               (.content response)))
        (is (= :connected
               (-> @(:state srv) vals first))))
      (finally
