Function with single argument callback
Connects to a host and returns true or false wether a connection was made

@param key Hostname
@param Function Callback
970078
function checkHost(host,callback) {

	if(hostCache.get(host,callback)) {
		console.log('checkHost: Resolved %s from hostCache...',host);
		return true;
	}

	console.log('checkHost: Looking up %s...',host);

	var options = {
		host: host,
		port: 80,
		path: '/',
		method: 'GET'
	};

	var req = http.request(options, function(res) {
		var data = '';
		res.setEncoding('utf8');

		res.on('data', function (chunk) {
			data += chunk;
		});
		res.on('end', function () {
			hostCache.set(host,true);
		});
		res.on('error',function() {
			hostCache.set(host,false);
		});
	});
	req.on('error',function() {
		hostCache.set(host,false);
	});
	req.end();
}
719379
function(callback) {
        var scarlet = new Scarlet(Math.min(opts.n, 100));

        function connect(taskObject) {
            var client = taskObject.task.client;
            var i = taskObject.task.idx;

            client.connect(function() {
                scarlet.taskDone(taskObject);
            });

            client.on("error", function(err) {
                console.log(err + ": Client " + i);
            });
        }

        console.time("Connect");

        // if mode is `clients`, we create (opts.complicating) clients,
        // otherwise we create only one.
        var max = opts["complicating-mode"] === "clients" ? opts.complicating : 1;
        for(var i = 0; i < max; i++) {
            var client = illyria2.createClient("127.0.0.1", SERVER_PORT, {
                runTimeout: 10000,
                retryInterval: 1000,
                reconnect: true
            });

            scarlet.push({ idx: i, client: client }, connect);

            clients.push(client);
        }

        scarlet.afterFinish(max, function() {
            console.timeEnd("Connect");
            callback();
        }, false);
    }
881903
function(callback) {
                connection.end();

                client.close();
                client.__sftp = null;
                client.__ssh = null;

                callback();
            }
53607
function Connect(client, key) {
  if (!client) {
    throw new Error('DNT Connect client not defined');
  }

  if (!key) {
    throw new Error('DNT Connect key not defined');
  }

  this.client = client;
  this.key = new Buffer(key, 'base64');

  return this;
}
1240387
public void accept(String key, $.Function<WebSocketConnection, ?> visitor) {
        ConcurrentMap<WebSocketConnection, WebSocketConnection> connections = registry.get(key);
        if (null == connections) {
            return;
        }
        if (!connections.isEmpty()) {
            lock.lock();
            try {
                List<WebSocketConnection> toBeCleared = null;
                for (WebSocketConnection conn : connections.keySet()) {
                    if (conn.closed()) {
                        if (null == toBeCleared) {
                            toBeCleared = new ArrayList<>();
                        }
                        toBeCleared.add(conn);
                        continue;
                    }
                    visitor.apply(conn);
                }
                if (null != toBeCleared) {
                    ConcurrentMap<WebSocketConnection, WebSocketConnection> originalCopy = registry.get(key);
                    originalCopy.keySet().removeAll(toBeCleared);
                }
            } finally {
                lock.unlock();
            }
        }
    }
824542
function(parameters,callback){
         if (parameters.requestUrl && parameters.isCluster) {
            var clusterUrl = ortcTreatUrl(parameters.requestUrl);

            getServerFromCluster({
                clusterUri : clusterUrl, 
                appKey : parameters.appKey
            }, 
            function (error, body) {
                if (error != null) {
                    callback('Error getting server from Cluster',null);
                }
                else {
                    var resultUrl = body.substring(body.indexOf('=') + 3, body.length - 2);
                    callback(null,resultUrl);
                }
            });
        }
        else {
            var resultUrl = ortcTreatUrl(parameters.requestUrl);
            callback(null,resultUrl);
        }
    }
1113774
@Override
    public void connect(String server, int port, String application, IPendingServiceCallback connectCallback) {
        log.debug("connect server: {} port {} application {} connectCallback {}", new Object[] { server, port, application, connectCallback });
        connect(server, port, makeDefaultConnectionParams(server, port, application), connectCallback);
    }
942988
function (_callback)
    {
        Strophe.error("Server did not send any auth methods");
        this._conn._changeConnectStatus(Strophe.Status.CONNFAIL, "Server did not send any auth methods");
        if (_callback) {
            _callback = _callback.bind(this._conn);
            _callback();
        }
        this._conn._doDisconnect();
    }
1303011
function serverReady (port, ...args) {
  const start = new Date()
  let timeout = serverReady.timeout
  let host, hostOrTimeout, cb

  switch (args.length) {
    case 1:
      [cb] = args
      break
    case 2:
      [hostOrTimeout, cb] = args
      if (typeof hostOrTimeout === 'string') {
        host = hostOrTimeout
      } else {
        timeout = hostOrTimeout
      }
      break
    default:
      [host, timeout, cb] = args
  }

  cb = once(cb)

  let ready = false
  const connect = (port, cb) => {

    const client = net
      .connect({ port, host })
      .on('connect', () => {

        ready = true
        client.destroy()
        cb()

      })
      .on('error', () => {

        client.destroy()

      })
      .once('close', () => {

        if (new Date() - start > timeout) {
          return cb(new Error('Timeout'))
        }

        setTimeout(() => !ready && connect(port, cb), interval)

      })

  }

  connect(port, cb)
}
1190530
function func2(data, cb, resource) {
  let error
  log.debug('Calling func2', data)
  cb(error)
  return false
}
369908
public void getDomainPatches(final AsyncCallback<List<Patches>> callback) {
        final List<Patches> patches = new ArrayList<>();
        final List<Function<List<Patches>>> functions = new ArrayList<>();
        for (String host : hostStore.getHostNames()) {
            functions.add(new ReadPatches(host));
        }

        //noinspection unchecked
        new Async<List<Patches>>().parallel(patches, new Outcome<List<Patches>>() {
            @Override
            public void onFailure(List<Patches> context) {
                callback.onSuccess(context);
            }

            @Override
            public void onSuccess(List<Patches> context) {
                callback.onSuccess(context);

            }
        }, functions.toArray(new Function[functions.size()]));
    }
44233
function (key, val, ttl, callback) {
            //ttl is optional
            if (_.isFunction(ttl)) {
                callback = ttl;
                ttl = undefined;
            }

            //callback is optional
            callback = callback || _.noop;
            client.set(key, val, ttl, callback);
        }
313510
function ping (host, callback) {
  var isWin = process.platform.indexOf('win') === 0; // win32 or win64
  var arg = isWin ? '-n' : '-c';
  var pong = spawn('ping', [arg, '3', host]); // only ping 3 times

  pong.on('error', function onerror (error) {
    callback(error, false);
    pong.kill();
  });

  pong.stdout.on('data', function stdoutdata (data) {
    callback(false, data.toString().split('\n')[0].substr(14));
    pong.kill();
  });

  pong.stderr.on('data', function stderrdata (data) {
    callback(new Error(data.toString().split('\n')[0].substr(14)), false);
    pong.kill();
  });
}
9627
function(hostname, callback) {
  get_nodes(function(err,nodes) {
    if (err) return callback(err);

    var n = nodes.filter(function(node) {
      return node.name === hostname;
    });

    callback(null,(n.length === 1) ? n[0].ip_address : null);
  });
}
317013
private boolean checkIfHostHasChanged(EventChannelStruct event_channel_struct) {
        boolean retVal = false;
        try {
            IORdump dump = new IORdump(event_channel_struct.adm_device_proxy);
            String server_host = dump.get_hostname();

            //	Keep server_host name without Fully Qualify Domain Name
            int idx = server_host.indexOf('.');
            if (idx > 0)
                server_host = server_host.substring(0, idx);

            if (!event_channel_struct.host.equals(server_host))
                retVal = true;
        } catch (DevFailed e) { /* */ }
        return retVal;
    }
500886
function connectToURL(url) {
        if (_connectDeferred) {
            // reject an existing connection attempt
            _connectDeferred.reject("CANCEL");
        }
        var deferred = new $.Deferred();
        _connectDeferred = deferred;
        var promise = getDebuggableWindows();
        promise.done(function onGetAvailableSockets(response) {
            var i, page;
            for (i in response) {
                page = response[i];
                if (page.webSocketDebuggerUrl && page.url.indexOf(url) === 0) {
                    connect(page.webSocketDebuggerUrl);
                    // _connectDeferred may be resolved by onConnect or rejected by onError
                    return;
                }
            }
            deferred.reject(FileError.ERR_NOT_FOUND); // Reject with a "not found" error
        });
        promise.fail(function onFail(err) {
            deferred.reject(err);
        });
        return deferred.promise();
    }
628403
function (callback) {
            if (!self.commandBumper) {
              return callback(null);
            }
            debug('');

            self.commandBumper.on('connect', function () {
              self.emit('connect');
            });

            self.commandBumper.on('disconnect', function () {
              self.emit('disconnect');
            });

            self.commandBumper.connect(callback);
          }