       (throw (IllegalArgumentException.
                (str "Every codec must specify a header path: "
                     (pr-str bad-codecs)))))
-    (MuxCodec.
-      "/multicodec"
-      codec-map
-      find-encodable
-      find-decodable)))
+    (MuxCodec. "/multicodec" codec-map)))
 
 
 ;; Remove automatic constructor functions.



(defrecord MuxCodec
  [header codecs select-encoder select-decoder]

  codec/Encoder

  (encodable?
    [this value]
    (boolean (when-let [codec (get codecs (select-encoder codecs value))]
               (codec/encodable? codec value))))


  (encode!
    [this output value]
    (let [codec-key (select-encoder codecs value)
          codec (resolve-codec! codecs codec-key value)]
      (when (bound? #'*dispatched-codec*)
        (set! *dispatched-codec* codec-key))
      (wrap/write-header-encoded! codec output (:header codec) value)))



  (decodable?
    [this header']
    (boolean (find-decodable codecs header')))


  (decode!
    [this input]
    (let [header' (header/read-header! input)
          [codec-key codec] (find-decodable codecs header')]
      (when-not codec
        (throw (ex-info
                 (str "No codecs can decode header: " (pr-str header'))
                 {:codecs (keys codecs)
                  :header header'})))
      (when (and (bound? #'*dispatched-codec*)
                 (nil? *dispatched-codec*))
        (set! *dispatched-codec* codec-key))
      (codec/decode! codec input))))

