                 (do (println "quit") (.close listener))
 
                 :else
-                (do (and listener (>! ch (.accept listener)))
+                (do (and listener (>! ch listener))
                     (recur backends listener config))))))
     shutdown))

  "a channel that accepts nio SocketChannels and relays the data being sent to them onto a new connection to host:port"
  [host port]
  (let [ch (chan)]
    (go
      (loop []
        (let [socketchannel (<! ch)]
          (when socketchannel
            (when (instance? SocketChannel socketchannel)
              (relay-to-backend socketchannel host port)

            [clojure.java.io :as io]
            [clojure.pprint :refer [pprint]]
            [clojure.core.async :as async
             :refer [<! <!! go chan >! close! alts!]]))

(defn server-socket
  "Opens a ServerSocketChannel listening on the specified TCP `port` then
