 
 (deftest controller-prevent-spoofed-sender-test
   (let [response (promise)]
-    (with-redefs [server/on-connect (fn [_ ws] (websockets-client/send! ws (message/encode spoof-sender-request)))
+    (with-redefs [server/on-connect (fn [_ ws]
+                    (try
+                      (websockets-client/send! ws (message/encode spoof-sender-request))
+                      (catch Exception e (println "controller-prevent-spoofed-sender-test exception:" (.getMessage e)))))
                   server/on-text (fn [_ ws text] (deliver response (message/decode text)))]
       (with-app-with-config app (conj broker-services server/mock-server) broker-config
         (let [answer (deref response 3000 nil)]


(deftest controller-whitelist-test
  (let [response (promise)]
    (with-redefs [server/on-connect (fn [_ ws] (websockets-client/send! ws (message/encode self-request)))
                  server/on-text (fn [_ ws text] (deliver response (message/decode text)))]
      (with-app-with-config app (conj broker-services server/mock-server) broker-config
        (let [answer (deref response 3000 nil)]

  (let [responses {:mock-server-1 [(promise) (promise)]
                   :mock-server-2 [(promise) (promise)]
                   :mock-server-3 [(promise) (promise)]}]
    (with-redefs [server/on-connect (fn [_ ws]
                    (try
                      (websockets-client/send! ws (message/encode inventory-request))
                      (catch Exception e (println "multiple-controllers-test exception:" (.getMessage e)))))
                  server/on-text (fn [server ws text]
                    (let [[response1 response2] (get responses server)]
                      (if-not (realized? response1)
