Class Server

java.lang.Object
ch.nolix.base.net.executoranddataproviderserver.AbstractServer
ch.nolix.base.net.executoranddataproviderserver.Server
All Implemented Interfaces:
Clearable, EmptinessRequestable, Server, SecurityModeHolder, Closeable, GroupCloseable, OpennessRequestable, AutoCloseable

public final class Server extends AbstractServer
A Server is a AbstractServer that listens to NetEndPoint on a specific port.
Author:
Silvan Wyss
  • Method Details

    • forPort

      public static Server forPort(int port)
      Parameters:
      port -
      Returns:
      a new Server that will listen to NetEndPoints on the given port
      Throws:
      RuntimeException - if the given port is not in [0, 65535]
    • forPortAndHttpMessage

      public static Server forPortAndHttpMessage(int port, String httpMessage)
      Parameters:
      port -
      httpMessage -
      Returns:
      a new Server that will listen to NetEndPoints on the given port. When a web browser connects to the Server, the Server will send the given httpMessage and close the connection
      Throws:
      RuntimeException - if the given port is not in [0, 65535]
      RuntimeException - if the given httpMessage is null
      RuntimeException - if the given httpMessage is blank
    • getPort

      public int getPort()
      Returns:
      the port of the current Server.
    • getSecurityMode

      public SecurityMode getSecurityMode()
      Returns:
      the SecurityMode of the current SecurityModeHolder