 
   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 (get codecs codec-key)]
-      (when-not codec-key
-        (throw (ex-info
-                 (str "No encoder selected for value: " (pr-str value))
-                 {:codec-keys (keys codecs)
-                  :value value})))
-      (when-not codec
-        (throw (ex-info
-                 (str "Selected encoder " codec-key " which is not present in"
-                      " the codec map " (pr-str (seq (keys codecs)))
-                      " for value: " (pr-str value))
-                 {:codec-keys (keys codecs)
-                  :encoder codec-key
-                  :value 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)))


  codec/Decoder

  (decode!
    [this input]
    (let [header (header/read-header! input)
          codec-key (select-decoder codecs header)
          codec (get codecs codec-key)]
      (when-not codec-key
        (throw (ex-info
                 (str "No decoder selected for header: " (pr-str header))
                 {:codec-keys (keys codecs)
                  :header header})))
      (when-not codec
        (throw (ex-info
                 (str "Selected decoder " codec-key " which is not present in"
                      " the codec map " (pr-str (seq (keys codecs)))
                      " for header: " (pr-str header))
                 {:codec-keys (keys codecs)
                  :decoder codec-key
                  :header header})))
      (when (bound? #'*dispatched-codec*)
        (set! *dispatched-codec* codec-key))
      (codec/decode! codec input))))

                         (pr-str codec-key) " " (pr-str (keys (:codecs mux))))
                    {:codec-keys (keys (:codecs mux))
                     :key codec-key}))))


(defn mux-codec
