Interface ConnectionPorts


public interface ConnectionPorts
Provides access to the ports that can be used to connect to a RunningService.
Since:
3.1.0
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    get(int containerPort)
    Return the host port mapped to the given container port.
    Return all host ports in use.
    getAll(@Nullable String protocol)
    Return all host ports in use that match the given protocol.
  • Method Details

    • get

      int get(int containerPort)
      Return the host port mapped to the given container port.
      Parameters:
      containerPort - the container port. This is usually the standard port for the service (e.g. port 80 for HTTP)
      Returns:
      the host port. This can be an ephemeral port that is different from the container port
      Throws:
      IllegalStateException - if the container port is not mapped
    • getAll

      List<Integer> getAll()
      Return all host ports in use.
      Returns:
      a list of all host ports
      See Also:
    • getAll

      List<Integer> getAll(@Nullable String protocol)
      Return all host ports in use that match the given protocol.
      Parameters:
      protocol - the protocol in use (for example 'tcp') or null to return all host ports
      Returns:
      a list of all host ports using the given protocol