public final class SimpleSmtpServer extends Object implements AutoCloseable
| Modifier and Type | Field and Description |
|---|---|
static int |
AUTO_SMTP_PORT
pick any free port.
|
static int |
DEFAULT_SMTP_PORT
Default SMTP port is 25.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
synonym for
stop() |
int |
getPort() |
List<SmtpMessage> |
getReceivedEmails() |
void |
reset()
forgets all received emails
|
static SimpleSmtpServer |
start(int port)
Creates an instance of a started SimpleSmtpServer.
|
void |
stop()
Stops the server.
|
public static final int DEFAULT_SMTP_PORT
public static final int AUTO_SMTP_PORT
public static SimpleSmtpServer start(int port) throws IOException
port - port number the server should listen toIOException - when listening on the socket causes onepublic int getPort()
public List<SmtpMessage> getReceivedEmails()
SmtpMessages received by since start up or last reset.public void reset()
public void stop()
public void close()
stop()close in interface AutoCloseableCopyright © 2016. All rights reserved.