code: @Override
      public void exceptionCaught(IoSession session, Throwable cause) {
          final IoSessionInputStream in = (IoSessionInputStream) session
                  .getAttribute(KEY_IN);
  
          IOException e = null;
          if (cause instanceof StreamIoException) {
              e = (IOException) cause.getCause();
          } else if (cause instanceof IOException) {
              e = (IOException) cause;
          }
  
          if (e != null && in != null) {
              in.throwException(e);
          } else {
              LOGGER.warn("Unexpected exception.", cause);
              session.close(true);
          }
      }
docs: Forwards caught exceptions to input stream.