code: private void disposeEncoder(IoSession session) {
          ProtocolEncoder encoder = (ProtocolEncoder) session
                  .removeAttribute(ENCODER);
          if (encoder == null) {
              return;
          }
  
          try {
              encoder.dispose(session);
          } catch (Throwable t) {
              LOGGER.warn(
                      "Failed to dispose: " + encoder.getClass().getName() + " (" + encoder + ')');
          }
      }
docs: Dispose the encoder, removing its instance from the
  session's attributes, and calling the associated
  dispose method.