code: function checkAvailable(host, port) {
    return new Promise(function(resolve, reject) {
      const socket = new net.Socket();
  
      socket.on('connect', () => {
        cleanupSocket(socket);
        resolve(true);
      });
  
      socket.on('error', err => {
        cleanupSocket(socket);
        if (err.code !== 'ECONNREFUSED') {
          return reject(err);
        }
  
        resolve(false);
      });
  
      socket.connect({ port: port, host: host });
    });
  }
docs: Checks if a provided address is actively listening for incoming connections
  
  @param {string} host the host to connect to
  @param {number} port the port to check for availability