code: public static boolean canTelnet(String ip, int port, int timeout) {
          Socket socket = null;
          try {
              socket = new Socket();
              socket.connect(new InetSocketAddress(ip, port), timeout);
              return socket.isConnected() && !socket.isClosed();
          } catch (Exception e) {
              return false;
          } finally {
              IOUtils.closeQuietly(socket);
          }
      }
docs: 是否可以telnet
  
  @param ip      远程地址
  @param port    远程端口
  @param timeout 连接超时
  @return 是否可连接