docs: function check(port, host) {
  
      var deferred = getDeferred();
      var inUse = true;
      var client;
  
      var opts;
      if (!is.obj(port)) {
          opts = makeOptionsObj(port, host);
      } else {
          opts = port;
      }
  
      if (!is.port(opts.port)) {
          debug('Error invalid port: '+util.inspect(opts.port));
          deferred.reject(new Error('invalid port: '+util.inspect(opts.port)));
          return deferred.promise;
      }
  
      if (is.nullOrUndefined(opts.host)) {
          debug('set host address to default 127.0.0.1');
          opts.host = '127.0.0.1';
      }
  
      function cleanUp() {
          if (client) {
              client.removeAllListeners('connect');
              client.removeAllListeners('error');
              client.end();
              client.destroy();
              client.unref();
          }
          //debug('listeners removed from client socket');
      }
  
      function onConnectCb() {
          //debug('check - promise resolved - in use');
          deferred.resolve(inUse);
          cleanUp();
      }
  
      function onErrorCb(err) {
          if (err.code !== 'ECONNREFUSED') {
              //debug('check - promise rejected, error: '+err.message);
              deferred.reject(err);
          } else {
              //debug('ECONNREFUSED');
              inUse = false;
              //debug('check - promise resolved - not in use');
              deferred.resolve(inUse);
          }
          cleanUp();
      }
  
      client = new net.Socket();
      client.once('connect', onConnectCb);
      client.once('error', onErrorCb);
      client.connect({port: opts.port, host: opts.host}, function() {});
  
      return deferred.promise;
  }