           w
           (do (.clear b) nil))))))
 
-(defn read-pending-buffer [buffer from-channel to-channel]
+(defn read-pending-buffer [^ByteBuffer buffer
+                           ^SocketChannel from-channel
+                           to-channel]
   (let [b buffer
         c (.read from-channel b)]
     (cond

      v)))

(defn poll-channels [poll-set timeout]
  (with-open [bo (reduce (fn [s [channel & ops]]
                           (.register channel s (poll-ops-mask ops))
                           s)
                         (Selector/open)
                         poll-set)]
    (doall ; have to force evaluation of this before closing selector
     (poll-selector bo timeout))))


        (.write ssh msg)
        (is (ready-for? (poll-channels [[ssh :read]] 1357) ssh :read))))))

(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
