Class AbstractServer

    • Method Detail

      • createProtocolHandler

        protected abstract ProtocolHandler createProtocolHandler​(Socket clientSocket)
        Create a new, specific protocol handler such as for IMAP.
        Parameters:
        clientSocket - the client socket to use.
        Returns:
        the new protocol handler.
      • run

        public void run()
        Specified by:
        run in interface Runnable
        Overrides:
        run in class Thread
      • initServerSocket

        protected void initServerSocket()
      • closeServerSocket

        protected void closeServerSocket()
        Closes the server socket.
      • setClientSocketTimeout

        public void setClientSocketTimeout​(int clientSocketTimeout)
      • quit

        protected void quit()
        Quits server by closing server socket and closing client socket handlers.
      • getBindTo

        public String getBindTo()
      • getPort

        public int getPort()
      • getProtocol

        public String getProtocol()
      • waitTillRunning

        public boolean waitTillRunning​(long timeoutInMs)
                                throws InterruptedException
        Description copied from interface: Service
        Waits till service is up or timeout was reached.
        Specified by:
        waitTillRunning in interface Service
        Parameters:
        timeoutInMs - the timeout in milliseconds
        Returns:
        true, if running otherwise false if timeout was reached.
        Throws:
        InterruptedException - if interrupted while waiting.
      • isRunning

        public boolean isRunning()
        Description copied from interface: Service
        Checks if service is up and running.
        Specified by:
        isRunning in interface Service
        Returns:
        true, if running.
      • setRunning

        protected void setRunning​(boolean r)
      • keepOn

        protected final boolean keepOn()
      • stopService

        public final void stopService​(long millis)
        Stops the service. If a timeout is given and the service has still not gracefully been stopped after timeout ms the service is stopped by force.
        Specified by:
        stopService in interface Service
        Parameters:
        millis - value in ms
      • stopService

        public final void stopService()
        Stops the service (without timeout).
        Specified by:
        stopService in interface Service
      • createSession

        public jakarta.mail.Session createSession​(Properties properties)
        Creates a session configured for given server (IMAP, SMTP, ...).
        Parameters:
        properties - optional session properties, can be null.
        Returns:
        the session.
      • createSession

        public jakarta.mail.Session createSession​(Properties properties,
                                                  boolean debug)
        Creates a session configured for given server (IMAP, SMTP, ...).
        Parameters:
        properties - optional session properties, can be null.
        debug - if true enables JavaMail debug settings
        Returns:
        the session.
      • createSession

        public jakarta.mail.Session createSession()
        Creates a session configured for given server (IMAP, SMTP, ...).
        Returns:
        the session.
      • createStore

        public jakarta.mail.Store createStore()
                                       throws jakarta.mail.NoSuchProviderException
        Creates a new JavaMail store.
        Returns:
        a new store.
        Throws:
        jakarta.mail.NoSuchProviderException