code: public void start() {
          if (shutdown.compareAndSet(true, false)) {
              Runtime.getRuntime().addShutdownHook(shutdownHook);
              try {
                  selector = Selector.open();
                  acceptorSvr = ServerSocketChannel.open();
                  if (host == null) {
                      acceptorSvr.socket().bind(new InetSocketAddress(port));
                  } else {
                      acceptorSvr.socket()
                          .bind(new InetSocketAddress(InetAddress.getByName(host), port));
                  }
                  acceptorSvr.configureBlocking(false);
                  acceptorSvr.register(selector, SelectionKey.OP_ACCEPT);
                  log.info(
                      "Listening on port: " + Integer.toString(acceptorSvr.socket().getLocalPort()));
  
                  Runnable action = () -> {
                      while (!shutdown.get()) {
                          try {
                              selector.select(SELECT_TIME_GAP);
                              Set<SelectionKey> selectionKeys = selector.selectedKeys();
                              Iterator<SelectionKey> it = selectionKeys.iterator();
                              while (it.hasNext()) {
                                  SelectionKey key = it.next();
                                  it.remove();
                                  try {
                                      handlerSelectionKey(key);
                                  } catch (Throwable t) {
                                      if (key != null) {
                                          key.cancel();
                                          if (key.channel() != null) {
                                              key.channel().close();
                                          }
                                      }
                                      log.error("An error occurs in telnet session.", t);
                                  }
                              }
                          } catch (Throwable t) {
                              log.error("An error occurs in telnet server.", t);
                              if (shutdown.get()) {
                                  break;
                              }
                          }
                      }
                  };
  
                  ThreadUtil.createPool(ThreadUtil.PoolType.Singleton, "telnet线程-%d").execute(action);
              } catch (IOException e) {
                  log.error("Unable to open telnet.", e);
                  throw new IOExceptionWrapper(e);
              }
          }
      }
docs: 启动telnet服务端