do {
nodeCandidate = nodeList.get(Randomizer.getInt(0, nodeList.size()));
log.debug("Node candidate {}", nodeCandidate);
if (RemoteHost.ping(nodeCandidate)) {
RemoteHost remoteHost = new RemoteHost(nodeCandidate,
getProperty("test.node.login"),
getProperty("test.node.passwd"));
try {
remoteHost.start();
int xvfb = remoteHost.runAndWaitCommand("xvfb-run");
if (xvfb != 2) {
log.debug("Node {} has no Xvfb", nodeCandidate);
} else {
nodes.add(new Node(nodeCandidate, browser, video, audio));
}
} catch (Exception e) {
log.debug("Invalid credentials to access node {} ",
nodeCandidate);
} finally {
remoteHost.stop();
}
} else {
log.debug("Node {} seems to be down", nodeCandidate);
}