String[] param = {"-port", "4444", "-host", "localhost"};
IOSServerConfiguration config = IOSServerConfiguration.create(param);
IOSServer server = new IOSServer(config);
server.start();
RemoteWebDriver driver = null;
URL url = new URL("http://localhost:4444/wd/hub");
IOSCapabilities caps = IOSCapabilities.iphone("Safari");
driver = new RemoteWebDriver(url, caps);
HttpClient client = HttpClientFactory.getClient();
String s = url + "/status";
URL u = new URL(s);
BasicHttpEntityEnclosingRequest
r =
new BasicHttpEntityEnclosingRequest("GET", u.toExternalForm());
HttpHost h = new HttpHost(u.getHost(), u.getPort());
HttpResponse response = client.execute(h, r);
JSONObject o = Helper.extractObject(response);
File base = new File("server/src/test/resources/mock");
File status = new File(base, "status.json");
FileWriter writer = new FileWriter(status);
writer.write(o.toString(2));
writer.close();
driver.quit();
server.stop();
}