All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.testvagrant.optimus.commons.PortGenerator Maven / Gradle / Ivy

Go to download

Optimus Lite API to manage test devices and create appium driver based on platform

There is a newer version: 0.1.7-beta
Show newest version
package com.testvagrant.optimus.commons;

import java.io.IOException;
import java.net.ServerSocket;

public class PortGenerator {

  public static Integer aRandomOpenPortOnAllLocalInterfaces() {
    try (ServerSocket socket = new ServerSocket(0); ) {
      return socket.getLocalPort();
    } catch (IOException e) {
      throw new RuntimeException("no open ports found for bootstrap");
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy