当前位置: 首页>>代码示例>>Java>>正文


Java ServerSetup.setServerStartupTimeout方法代码示例

本文整理汇总了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();
    });
}
 
开发者ID:anand1st,项目名称:sshd-shell-spring-boot,代码行数:15,代码来源:SshdShellAutoConfigurationTest.java

示例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();
    });
}
 
开发者ID:anand1st,项目名称:sshd-shell-spring-boot,代码行数:15,代码来源:SshdShellAutoConfigurationTest.java

示例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();
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:11,代码来源:EmailSubscriptionDstu3Test.java

示例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();
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:9,代码来源:JavaMailEmailSenderTest.java

示例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();
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:9,代码来源:EmailSubscriptionDstu2Test.java

示例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();
}
 
开发者ID:terrestris,项目名称:shogun2,代码行数:15,代码来源:MailPublisherTest.java

示例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;
}
 
开发者ID:greenmail-mail-test,项目名称:greenmail,代码行数:15,代码来源:GreenMailBean.java

示例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;
}
 
开发者ID:RoboZonky,项目名称:robozonky,代码行数:7,代码来源:EmailingListenerTest.java

示例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();
    }
}
 
开发者ID:jcabi,项目名称:jcabi-email,代码行数:53,代码来源:SmtpsTest.java

示例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();
    }
}
 
开发者ID:jcabi,项目名称:jcabi-email,代码行数:54,代码来源:SmtpTest.java


注:本文中的com.icegreen.greenmail.util.ServerSetup.setServerStartupTimeout方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。