Code example for InetSocketAddress

0
 
    URI remoteUri =
        URI.create("http://127.0.0.1" + (driverPort == 80 ? "" : (":" + driverPort)) + "/");
 
    webServer =
        WebServers.createWebServer(Executors.newCachedThreadPool(), new InetSocketAddress(
            driverPort), remoteUri);
    init(androidInstrumentation);
  } 
 
  public AndroidServer(ServerInstrumentation androidInstrumentation, int port) {
    driverPort = port;
    webServer = WebServers.createWebServer(Executors.newCachedThreadPool(), driverPort);
    init(androidInstrumentation);
  } 
 
  protected void init(ServerInstrumentation androidInstrumentation) {
    SelendroidDriver driver = new DefaultSelendroidDriver(androidInstrumentation);
    // seems like this must be set first 
    webServer.staleConnectionTimeout(604800000); // 1 week.
    // If the stale connection cleanup is called a ConcurrentModification exception will be thrown.