Enum Class SMTPServerHandler

java.lang.Object
java.lang.Enum<SMTPServerHandler>
com.nilhcem.fakesmtp.server.SMTPServerHandler
All Implemented Interfaces:
Serializable, Comparable<SMTPServerHandler>, java.lang.constant.Constable

public enum SMTPServerHandler extends Enum<SMTPServerHandler>
Starts and stops the SMTP server.
Since:
1.0
Author:
Nilhcem
  • Enum Constant Details

  • Method Details

    • values

      public static SMTPServerHandler[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static SMTPServerHandler valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • startServer

      public void startServer(int port, InetAddress bindAddress) throws BindPortException, OutOfRangePortException
      Starts the server on the port and address specified in parameters.
      Parameters:
      port - the SMTP port to be opened.
      bindAddress - the address to bind to. null means bind to all.
      Throws:
      BindPortException - when the port can't be opened.
      OutOfRangePortException - when port is out of range.
      IllegalArgumentException - when port is out of range.
    • stopServer

      public void stopServer()
      Stops the server.

      If the server is not started, does nothing special.

    • getMailSaver

      public MailSaver getMailSaver()
      Returns the MailSaver object.
      Returns:
      the MailSaver object.
    • getSmtpServer

      public org.subethamail.smtp.server.SMTPServer getSmtpServer()
      Returns the SMTPServer object.
      Returns:
      the SMTPServer object.