Class ForceServerListenPortImposition

  • All Implemented Interfaces:
    Imposition

    public final class ForceServerListenPortImposition
    extends java.lang.Object
    implements Imposition
    Forces the port that the server should use to listen for requests.

    This imposition is used by ServerConfigBuilder. If present, the imposed value will be used regardless of any previously specified setting on the builder.

    Since:
    1.2
    See Also:
    ServerConfigBuilder.port(int), Impositions
    • Method Detail

      • ephemeral

        public static ForceServerListenPortImposition ephemeral()
        Creates an imposition that forces the use of an ephemeral port.
        Returns:
        an imposition for an ephemeral port
      • of

        public static ForceServerListenPortImposition of​(int port)
        Creates an imposition that forces the use of the specified port.
        Parameters:
        port - the port to force
        Returns:
        an imposition for the specified port
      • getPort

        public int getPort()
        The port to be forced.
        Returns:
        the port to be forced