Search in sources :

Example 1 with ProxySet

use of org.openqa.grid.internal.ProxySet in project selenium_java by sergueik.

the class MyConsoleServlet method getResponse.

private JSONObject getResponse() throws IOException, JSONException {
    JSONObject requestJSON = new JSONObject();
    ProxySet proxies = this.getRegistry().getAllProxies();
    Iterator<RemoteProxy> iterator = proxies.iterator();
    JSONArray busyProxies = new JSONArray();
    JSONArray freeProxies = new JSONArray();
    while (iterator.hasNext()) {
        RemoteProxy eachProxy = iterator.next();
        if (eachProxy.isBusy()) {
            busyProxies.put(eachProxy.getOriginalRegistrationRequest().getAssociatedJSON());
        } else {
            freeProxies.put(eachProxy.getOriginalRegistrationRequest().getAssociatedJSON());
        }
    }
    requestJSON.put("BusyProxies", busyProxies);
    requestJSON.put("FreeProxies", freeProxies);
    return requestJSON;
}
Also used : RemoteProxy(org.openqa.grid.internal.RemoteProxy) JSONObject(org.json.JSONObject) ProxySet(org.openqa.grid.internal.ProxySet) JSONArray(org.json.JSONArray)

Aggregations

JSONArray (org.json.JSONArray)1 JSONObject (org.json.JSONObject)1 ProxySet (org.openqa.grid.internal.ProxySet)1 RemoteProxy (org.openqa.grid.internal.RemoteProxy)1