Interface SocketConfiguration

  • All Known Subinterfaces:
    ServerConfiguration

    public interface SocketConfiguration
    The SocketConfiguration configures a port to listen on and its associated server socket parameters.
    • Field Detail

      • DEFAULT

        @Deprecated
        static final SocketConfiguration DEFAULT
        Deprecated.
        since 2.0.0 This configuration does not contain a name and will be removed
        The default socket configuration.
      • DEFAULT_BACKLOG_SIZE

        static final int DEFAULT_BACKLOG_SIZE
        The default backlog size to configure the server sockets with if no other value is provided.
        See Also:
        Constant Field Values
    • Method Detail

      • name

        default String name()
        Name of this socket. Default to WebServer.DEFAULT_SOCKET_NAME for the main and default server socket. All other sockets must be named.
        Returns:
        name of this socket
      • port

        int port()
        Returns a server port to listen on with the server socket. If port is 0 then any available ephemeral port will be used.
        Returns:
        the server port of the server socket
      • bindAddress

        InetAddress bindAddress()
        Returns local address where the server listens on with the server socket. If null then listens an all local addresses.
        Returns:
        an address to bind with the server socket; null for all local addresses
      • backlog

        int backlog()
        Returns a maximum length of the queue of incoming connections on the server socket.

        Default value is DEFAULT_BACKLOG_SIZE.

        Returns:
        a maximum length of the queue of incoming connections
      • timeoutMillis

        int timeoutMillis()
        Returns a server socket timeout in milliseconds or 0 for an infinite timeout.
        Returns:
        a server socket timeout in milliseconds or 0
      • receiveBufferSize

        int receiveBufferSize()
        Returns proposed value of the TCP receive window that is advertised to the remote peer on the server socket.

        If 0 then use implementation default.

        Returns:
        a buffer size in bytes of the server socket or 0
      • ssl

        SSLContext ssl()
        Returns a SSLContext to use with the server socket. If not null then the server enforces an SSL communication.
        Returns:
        a SSL context to use
      • enabledSslProtocols

        Set<String> enabledSslProtocols()
        Returns the SSL protocols to enable, or null to enable the default protocols.
        Returns:
        the SSL protocols to enable
      • enabled

        default boolean enabled()
        Whether this socket is enabled (and will be opened on server startup), or disabled (and ignored on server startup).
        Returns:
        true for enabled socket, false for socket that should not be opened
      • create

        static SocketConfiguration create​(String name)
        Create a default named configuration.
        Parameters:
        name - name of the socket
        Returns:
        a new socket configuration with defaults