         (.write ssh msg)
         (is (ready-for? (poll-channels [[ssh :read]] 1357) ssh :read))))))
 
-(defn accept-connection [socket]
-  (let [s1 (.accept socket)]
+(defn accept-connection [^ServerSocketChannel socket]
+  (let [s1 ^SocketChannel (.accept socket)]
     (when s1
       (when (log/may-log? :debug)
         ;; no need to getRemoteAddress if we don't have debug logging

            {}
            (:backends config))))

(defn get-port [listener]
  (.. listener socket getLocalPort))

(defn update-listener [listener config]
  (when-let [l (get-in config [:config :log-level])]
    (when-not (= l (:level log/*config*))
      (log/info (str "Setting log level to " l))

            ;; Note this may block in connect(), I haven't decided if that's
            ;; bad or not
            (get ready-channels serversocket)
            (if-let [sock ^SocketChannel
                     (log/spy :trace (accept-connection serversocket))]
              (let [ds (try
                         (doto (SocketChannel/open)
                           (.connect (InetSocketAddress. ^String host ^long port))
                           (debug "connected")
                           (.configureBlocking false))
                         (catch java.net.ConnectException e
