@BeforeClass
  public static void setup() throws Exception {
    registry = Registry.getNewInstanceForTestOnly();
    hub = Hub.getNewInstanceForTest(PortProber.findFreePort(), registry);

    status = new URL("http://" + hub.getHost() + ":" + hub.getPort() + "/grid/status");
    host = new HttpHost(hub.getHost(), hub.getPort());

    hub.start();

    p1 = RemoteProxyFactory.getNewBasicRemoteProxy("app1", "http://machine1:4444/");
    p2 = RemoteProxyFactory.getNewBasicRemoteProxy("app1", "http://machine2:4444/");
    p3 = RemoteProxyFactory.getNewBasicRemoteProxy("app1", "http://machine3:4444/");
    p4 = RemoteProxyFactory.getNewBasicRemoteProxy("app1", "http://machine4:4444/");

    RegistrationRequest req = new RegistrationRequest();
    Map<String, Object> capability = new HashMap<String, Object>();
    capability.put("applicationName", "custom app");
    req.addDesiredCapabilitiy(capability);

    Map<String, Object> config = new HashMap<String, Object>();
    config.put("url", "http://machine5:4444/");
    req.setConfiguration(config);
    customProxy = new MyCustomProxy(req);

    registry.add(p1);
    registry.add(p2);
    registry.add(p3);
    registry.add(p4);
    registry.add(customProxy);
  }
  @BeforeClass
  public static void setup() {
    registry = Registry.getNewInstanceForTestOnly();
    // A request that will create a proxy with 5 slots. Each slot can host a
    // firefox.
    Map<String, Object> config = new HashMap<String, Object>();
    ff.put(APP, "firefox");
    ff.put(MAX_INSTANCES, 5);
    request.addDesiredCapabilitiy(ff);

    config.put(MAX_SESSION, 5);

    // add 5 proxies. Total = 5 proxies * 5 slots each = 25 firefox.
    for (int i = 0; i < 5; i++) {
      config.put(REMOTE_URL, "http://machine" + i + ":4444");
      request.setConfiguration(config);
      registry.add(new RemoteProxy(request));
    }
  }