public class ServerSetup extends Object
| smtp | 25 |
| smtps | 465 |
| pop3 | 110 |
| pop3s | 995 |
| imap | 143 |
| imaps | 993 |
ServerSetupTest for non-default ports
ServerSetupTest for non-default ports| Modifier and Type | Field and Description |
|---|---|
static ServerSetup[] |
ALL |
static long |
CONNECTION_TIMEOUT
Default socket connection timeout.
|
static ServerSetup |
IMAP |
static ServerSetup |
IMAPS |
static ServerSetup |
POP3 |
static ServerSetup |
POP3S |
static int |
PORT_IMAP |
static int |
PORT_IMAPS |
static int |
PORT_POP3 |
static int |
PORT_POP3S |
static int |
PORT_SMTP |
static int |
PORT_SMTPS |
static String |
PROTOCOL_IMAP |
static String |
PROTOCOL_IMAPS |
static String |
PROTOCOL_POP3 |
static String |
PROTOCOL_POP3S |
static String |
PROTOCOL_SMTP |
static String |
PROTOCOL_SMTPS |
static String[] |
PROTOCOLS |
static long |
READ_TIMEOUT
Default socket read timeout.
|
static long |
SERVER_STARTUP_TIMEOUT
Default server startup timeout in milliseconds.
|
static ServerSetup |
SMTP |
static ServerSetup[] |
SMTP_IMAP |
static ServerSetup[] |
SMTP_POP3 |
static ServerSetup[] |
SMTP_POP3_IMAP |
static ServerSetup |
SMTPS |
static ServerSetup[] |
SMTPS_IMAPS |
static ServerSetup[] |
SMTPS_POP3S |
static ServerSetup[] |
SMTPS_POP3S_IMAPS |
| Constructor and Description |
|---|
ServerSetup(int port,
String bindAddress,
String protocol)
Creates a configuration.
|
| Modifier and Type | Method and Description |
|---|---|
Properties |
configureJavaMailSessionProperties(Properties properties,
boolean debug)
Creates default properties for a JavaMail session.
|
ServerSetup |
createCopy()
Create a deep copy.
|
ServerSetup |
createCopy(int port,
String bindAddress,
String protocol)
Create a deep copy.
|
static ServerSetup[] |
createCopy(ServerSetup[] serverSetups,
UnaryOperator<ServerSetup> copyMutator)
Creates a copy applying given mutator on each copy.
|
ServerSetup |
createCopy(String bindAddress)
Create a deep copy.
|
ServerSetup |
dynamicPort()
Enable dynamic port allocation.
|
static ServerSetup[] |
dynamicPort(ServerSetup[] serverSetups)
Creates a copy with dynamic ports (auto-detecting available ports) enabled.
|
boolean |
equals(Object o) |
String |
getBindAddress() |
long |
getConnectionTimeout() |
String |
getDefaultBindAddress()
Gets the public default host address "0.0.0.0" .
|
static String |
getLocalHostAddress() |
int |
getPort() |
String |
getProtocol() |
long |
getReadTimeout() |
long |
getServerStartupTimeout() |
long |
getWriteTimeout() |
int |
hashCode() |
boolean |
isDynamicPort()
True if available port gets dynamically allocated.
|
boolean |
isSecure() |
boolean |
isVerbose() |
static ServerSetup[] |
mailSessionProperty(ServerSetup[] serverSetups,
String key,
String value)
Creates a copy with configured default mail session property.
|
ServerSetup |
mailSessionProperty(String key,
String value)
Create a new server setup copy, configured with given JavaMail session property.
|
ServerSetup |
port(int port)
Creates a deep copy and updates port.
|
void |
setConnectionTimeout(long connectionTimeout) |
void |
setReadTimeout(long readTimeout) |
void |
setServerStartupTimeout(long timeoutInMs)
Sets the server startup timeout in milliseconds.
|
ServerSetup |
setVerbose(boolean verbose) |
void |
setWriteTimeout(long writeTimeout) |
String |
toString() |
ServerSetup |
verbose(boolean verbose)
Creates a deep copy with verbose configured.
|
static ServerSetup[] |
verbose(ServerSetup[] serverSetups)
Creates a copy with verbose mode enabled.
|
ServerSetup |
withPort(int port)
Deprecated.
use
port(int) - will be deprecated in 2.1 |
public static final String PROTOCOL_SMTP
public static final String PROTOCOL_SMTPS
public static final String PROTOCOL_POP3
public static final String PROTOCOL_POP3S
public static final String PROTOCOL_IMAP
public static final String PROTOCOL_IMAPS
public static final String[] PROTOCOLS
public static final int PORT_SMTP
public static final int PORT_SMTPS
public static final int PORT_POP3
public static final int PORT_POP3S
public static final int PORT_IMAP
public static final int PORT_IMAPS
public static final ServerSetup SMTP
public static final ServerSetup SMTPS
public static final ServerSetup POP3
public static final ServerSetup POP3S
public static final ServerSetup IMAP
public static final ServerSetup IMAPS
public static final ServerSetup[] SMTP_POP3
public static final ServerSetup[] SMTP_IMAP
public static final ServerSetup[] SMTP_POP3_IMAP
public static final ServerSetup[] SMTPS_POP3S
public static final ServerSetup[] SMTPS_POP3S_IMAPS
public static final ServerSetup[] SMTPS_IMAPS
public static final ServerSetup[] ALL
public static final long READ_TIMEOUT
public static final long CONNECTION_TIMEOUT
public static final long SERVER_STARTUP_TIMEOUT
public static String getLocalHostAddress()
public String getDefaultBindAddress()
public boolean isSecure()
public String getProtocol()
public String getBindAddress()
public int getPort()
public long getConnectionTimeout()
public void setConnectionTimeout(long connectionTimeout)
public long getReadTimeout()
public void setReadTimeout(long readTimeout)
public long getWriteTimeout()
public void setWriteTimeout(long writeTimeout)
public long getServerStartupTimeout()
@Deprecated public ServerSetup withPort(int port)
port(int) - will be deprecated in 2.1port - the port (0 for dynamic port allocation).public ServerSetup port(int port)
port - the port (0 for dynamic port allocation).public boolean isDynamicPort()
public ServerSetup dynamicPort()
public boolean isVerbose()
public ServerSetup setVerbose(boolean verbose)
verbose - if true enables JavaMail debug output by setting JavaMail property 'mail.debug'public ServerSetup verbose(boolean verbose)
verbose - if true enables JavaMail debug output by setting JavaMail property 'mail.debug'public void setServerStartupTimeout(long timeoutInMs)
timeoutInMs - timeout in milliseconds.public Properties configureJavaMailSessionProperties(Properties properties, boolean debug)
mail.debug when log level is debug or protocol specific settings
such as mail.smtp.portmail.PROTOCOL.port
For details see
properties - additional and optional properties which overwrite automatically added properties. Can be null.debug - sets JavaMail debug propertiespublic ServerSetup createCopy()
public ServerSetup createCopy(String bindAddress)
bindAddress - overwrites bind address when creating deep copy.public ServerSetup createCopy(int port, String bindAddress, String protocol)
port - overwrites the port.bindAddress - overwrites bind address.protocol - overwrites the protocol.public ServerSetup mailSessionProperty(String key, String value)
For protocol specific properties see
key - the keyvalue - the valuepublic static ServerSetup[] createCopy(ServerSetup[] serverSetups, UnaryOperator<ServerSetup> copyMutator)
serverSetups - the server setupscopyMutator - the mutator receiving the original server setup and returning a modified copypublic static ServerSetup[] verbose(ServerSetup[] serverSetups)
serverSetups - the server setups.public static ServerSetup[] dynamicPort(ServerSetup[] serverSetups)
serverSetups - the server setups.public static ServerSetup[] mailSessionProperty(ServerSetup[] serverSetups, String key, String value)
serverSetups - the server setups.key - the keyvalue - the valuemailSessionProperty(String, String)Copyright © 2006–2023 Icegreen Technologies. All rights reserved.