     "return the error string message from the error code"))
 
 (extend-type NginxHttpServerChannel HttpServerChannel
+  (closed? [ch] (.isClosed ch))
   (close [ch] (.close ch))
   (send! [ch data flush? last?]
     (cond

  (-> req (.handler) (.hijack req ignore-nginx-filter?)))

(defprotocol HttpServerChannel
  (close! [ch] 
    "Asynchronously close the channel. If there's remaining data to send it won't block 
     current thread  and will flush data on the background asynchronously and later close the channel safely")

                          (onOpen [c] (if on-open (on-open c)))
                          (onTextMessage [c msg rem?] (if on-message (on-message c msg rem?)))
                          (onBinaryMessage [c msg rem?] (if on-message (on-message c msg rem?)))
                          (onClose ;([c] (if on-close (on-close c "0")))
                                   ([c status reason] (if on-close (on-close c (str status ":" reason)))))
                          (onError [c status] (if on-error (on-error c (NginxClojureAsynSocket/errorCodeToString status)))))))
  (add-aggregated-listener! [ch max-message-size {:keys [on-open on-message on-close on-error]}]
    (.addListener ch ch (proxy [WholeMessageAdapter] [max-message-size]
                          (onOpen [c] (if on-open (on-open c)))
                          (onWholeTextMessage [c msg] (if on-message (on-message c msg)))
                          (onWholeBiniaryMessage [c msg rem?] (if on-message (on-message c msg)))
                          (onClose ;([c] (if on-close (on-close c "0")))
                                   ([c status reason] (if on-close (on-close c (str status ":" reason)))))
                          (onError [c status] (if on-error (on-error c (NginxClojureAsynSocket/errorCodeToString status)))))))
