code: private void removeHandlerIfActive(ChannelHandlerContext ctx, String name) {
          if (ctx.channel().isActive()) {
              ctx.pipeline().remove(name);
          }
      }
docs: Most operations we want to do even if the channel is not active, because if it's not, then we want to encounter
  the error that occurs when that operation happens and so that it can be passed up to the user. However, removing
  handlers should only be done if the channel is active, because the error that is encountered when they aren't
  makes no sense to the user (NoSuchElementException).