本文整理汇总了Java中com.icegreen.greenmail.util.ServerSetup.setServerStartupTimeout方法的典型用法代码示例。如果您正苦于以下问题:Java ServerSetup.setServerStartupTimeout方法的具体用法?Java ServerSetup.setServerStartupTimeout怎么用?Java ServerSetup.setServerStartupTimeout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.icegreen.greenmail.util.ServerSetup
的用法示例。
在下文中一共展示了ServerSetup.setServerStartupTimeout方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testHealthCommand
import com.icegreen.greenmail.util.ServerSetup; //导入方法依赖的package包/类
@Test
public void testHealthCommand() {
int smtpPort = SocketUtils.findAvailableTcpPort();
ServerSetup setup = new ServerSetup(smtpPort, null, ServerSetup.PROTOCOL_SMTP);
setup.setServerStartupTimeout(5000);
GreenMail mailServer = new GreenMail(setup);
mailServer.start();
((JavaMailSenderImpl) mailSender).setPort(smtpPort);
sshCallShell((is, os) -> {
write(os, "health");
verifyResponse(is, "{\r\n \"status\" : \"UP\"");
mailServer.stop();
});
}
示例2: testStatusCommand
import com.icegreen.greenmail.util.ServerSetup; //导入方法依赖的package包/类
@Test
public void testStatusCommand() {
int smtpPort = SocketUtils.findAvailableTcpPort();
ServerSetup setup = new ServerSetup(smtpPort, null, ServerSetup.PROTOCOL_SMTP);
setup.setServerStartupTimeout(5000);
GreenMail mailServer = new GreenMail(setup);
mailServer.start();
((JavaMailSenderImpl) mailSender).setPort(smtpPort);
sshCallShell((is, os) -> {
write(os, "status");
verifyResponse(is, "{\r\n \"status\" : \"UP\"\r\n}");
mailServer.stop();
});
}
示例3: beforeClass
import com.icegreen.greenmail.util.ServerSetup; //导入方法依赖的package包/类
@BeforeClass
public static void beforeClass() {
ourListenerPort = RandomServerPortProvider.findFreePort();
ServerSetup smtp = new ServerSetup(ourListenerPort, null, ServerSetup.PROTOCOL_SMTP);
smtp.setServerStartupTimeout(2000);
smtp.setReadTimeout(2000);
smtp.setConnectionTimeout(2000);
ourTestSmtp = new GreenMail(smtp);
ourTestSmtp.start();
}
示例4: beforeClass
import com.icegreen.greenmail.util.ServerSetup; //导入方法依赖的package包/类
@BeforeClass
public static void beforeClass() {
ourPort = RandomServerPortProvider.findFreePort();
ServerSetup smtp = new ServerSetup(ourPort, null, ServerSetup.PROTOCOL_SMTP);
smtp.setServerStartupTimeout(2000);
ourTestSmtp = new GreenMail(smtp);
ourTestSmtp.start();
}
示例5: beforeClass
import com.icegreen.greenmail.util.ServerSetup; //导入方法依赖的package包/类
@BeforeClass
public static void beforeClass() {
ourListenerPort = RandomServerPortProvider.findFreePort();
ServerSetup smtp = new ServerSetup(ourListenerPort, null, ServerSetup.PROTOCOL_SMTP);
smtp.setServerStartupTimeout(2000);
ourTestSmtp = new GreenMail(smtp);
ourTestSmtp.start();
}
示例6: startMailServer
import com.icegreen.greenmail.util.ServerSetup; //导入方法依赖的package包/类
/**
* Start the mail server before each test.
*/
@BeforeClass
public static void startMailServer() {
ServerSetup smtp = ServerSetupTest.SMTP;
// set timeout as we ran into this issue with CI:
// https://github.com/greenmail-mail-test/greenmail/issues/76
smtp.setServerStartupTimeout(3000L);
greenMail = new GreenMail(smtp);
greenMail.start();
}
示例7: createTestServerSetup
import com.icegreen.greenmail.util.ServerSetup; //导入方法依赖的package包/类
/**
* Creates a test server setup with configured offset.
*
* @param theSetup the server setup.
* @return the test server setup.
*/
private ServerSetup createTestServerSetup(final ServerSetup theSetup) {
ServerSetup serverSetup =
new ServerSetup(portOffset + theSetup.getPort(),
hostname,
theSetup.getProtocol());
serverSetup.setServerStartupTimeout(serverStartupTimeout);
return serverSetup;
}
示例8: getServerSetup
import com.icegreen.greenmail.util.ServerSetup; //导入方法依赖的package包/类
private static ServerSetup getServerSetup() {
final ServerSetup setup = ServerSetupTest.SMTP;
setup.setServerStartupTimeout(5000);
setup.setVerbose(true);
return setup;
}
示例9: sendsEmailToTheServerThroughSmtps
import com.icegreen.greenmail.util.ServerSetup; //导入方法依赖的package包/类
/**
* SMTPS postman can send an email to the server through SMTPS wire.
* @throws Exception If fails
*/
@Test
public void sendsEmailToTheServerThroughSmtps() throws Exception {
final String bind = "localhost";
final int received = 1;
final int port = SmtpsTest.port();
final int timeout = 3000;
Security.setProperty(
"ssl.SocketFactory.provider",
DummySSLSocketFactory.class.getName()
);
final ServerSetup setup = new ServerSetup(
port, bind, ServerSetup.PROTOCOL_SMTPS
);
setup.setServerStartupTimeout(timeout);
final GreenMail server = new GreenMail(setup);
server.start();
try {
new Postman.Default(
new Smtps(
new Token("", "")
.access(new Protocol.Smtps(bind, port))
)
).send(
new Envelope.Safe(
new Envelope.Mime()
.with(new StSender("from <[email protected]>"))
.with(new StRecipient("to", "[email protected]"))
.with(new StSubject("test subject: test me"))
.with(new EnPlain("hello"))
)
);
final MimeMessage[] messages = server.getReceivedMessages();
MatcherAssert.assertThat(
messages.length, Matchers.is(received)
);
for (final Message msg : messages) {
MatcherAssert.assertThat(
msg.getFrom()[0].toString(),
Matchers.containsString("<[email protected]>")
);
MatcherAssert.assertThat(
msg.getSubject(), Matchers.containsString("test me")
);
}
} finally {
server.stop();
}
}
示例10: sendsEmailToSmtpServer
import com.icegreen.greenmail.util.ServerSetup; //导入方法依赖的package包/类
/**
* SMTP postman can send email through SMTP wire.
* @throws Exception If fails
*/
@Test
public void sendsEmailToSmtpServer() throws Exception {
final String bind = "localhost";
final int received = 3;
final int port = SmtpTest.port();
final int timeout = 3000;
final ServerSetup setup = new ServerSetup(
port, bind, ServerSetup.PROTOCOL_SMTP
);
setup.setServerStartupTimeout(timeout);
final GreenMail server = new GreenMail(setup);
server.start();
try {
new Postman.Default(
new Smtp(
new Token("", "")
.access(new Protocol.Smtp(bind, port))
)
).send(
new Envelope.Safe(
new Envelope.Mime()
.with(new StSender("from <[email protected]>"))
.with(new StRecipient("to", "[email protected]"))
.with(new StCc(new InternetAddress("cc <[email protected]>")))
.with(new StBcc("bcc <[email protected]>"))
.with(new StSubject("test subject: test me"))
.with(new EnPlain("hello"))
.with(new EnHtml("<p>how are you?</p>"))
)
);
final MimeMessage[] messages = server.getReceivedMessages();
MatcherAssert.assertThat(
messages.length,
Matchers.is(received)
);
for (final Message msg : messages) {
MatcherAssert.assertThat(
msg.getFrom()[0].toString(),
Matchers.containsString("<[email protected]>")
);
MatcherAssert.assertThat(
msg.getSubject(),
Matchers.containsString("test me")
);
}
} finally {
server.stop();
}
}