Examples of SMTPServer


Examples of org.subethamail.smtp.server.SMTPServer

        Collection<MessageListener> listeners = new ArrayList<MessageListener>(1);
        listeners.add(this);

        if( enableTls ) {
            log.info("Creating TLS enabled server");
            this.smtpReceivingServer = new SMTPServer(listeners);
        } else {
            log.info("Creating TLS DIS-abled server");
            this.smtpReceivingServer = new TlsDisabledSmtpServer(listeners);
        }
        this.smtpReceivingServer.setPort(smtpPort);
View Full Code Here

Examples of org.subethamail.smtp.server.SMTPServer

     *
     * @throws Exception
     */
    @PostConstruct
    public void startup() throws Exception {
        server = new SMTPServer(new SimpleMessageListenerAdapter(listener));
        server.setBindAddress(InetAddress.getLoopbackAddress());
        server.setPort(BIND_PORT);
        server.start();
    }
View Full Code Here

Examples of org.subethamail.smtp.server.SMTPServer

     * @param logger Used to log error messages.
     */
    public void start(final Logger logger) {
        logInfo(logger, "com.btmatthews.maven.plugin.emailserver.subethasmtp.starting");
        final MessageHandlerFactory messageHandlerFactory = new SimpleMessageHandlerFactory();
        server = new SMTPServer(messageHandlerFactory);
        if (isUseSSL()) {
            server.setPort(DEFAULT_SMTPS_PORT + getPortOffset());
            server.setEnableTLS(true);
            server.setRequireTLS(true);
        } else {
View Full Code Here

Examples of org.subethamail.smtp.server.SMTPServer

    private static SMTPServer SERVER;

    @BeforeClass
    public static void startEmbeddedServer() {
        assertNull("Server already initialized", SERVER);
        SERVER = new SMTPServer(new SimpleMessageListenerAdapter(SmtpServerListener.INSTANCE));
        SERVER.setHostName("localhost");
        SERVER.setPort(TEST_PORT);
        SERVER.start();
        System.out.println("Started embedded server on port " + SERVER.getPort());
    }
View Full Code Here

Examples of org.subethamail.smtp.server.SMTPServer

    /** Smtp server instance */
    private SMTPServer smtpServer;

    @Override
    protected void startup() {
        smtpServer = new SMTPServer(new SimpleMessageListenerAdapter(this));
        smtpServer.setSoftwareName(getName());
        smtpServer.setPort(port);
        smtpServer.start();
    }
View Full Code Here

Examples of org.subethamail.smtp.server.SMTPServer

 
  public void testSendMailWithChangedPort() throws Throwable {
   
    MockMessageHandlerFactory myFactory2 = new MockMessageHandlerFactory();
    MockAuthenticationHandlerFactory myAuthFactory2 = new MockAuthenticationHandlerFactory();
    SMTPServer smtpServer2 = new SMTPServer(myFactory2, myAuthFactory2);
        smtpServer2.setPort(25001);
        smtpServer2.start();
   
    MailConfig originaryConfig = this._mailManager.getMailConfig();
    try {
      MailConfig config = this._mailManager.getMailConfig();
      config.setSmtpPort(25001);
      this._mailManager.updateMailConfig(config);
      String[] mailAddresses = JpmailTestHelper.MAIL_ADDRESSES;
      this._mailManager.sendMail(MAIL_TEXT, "Mail semplice", mailAddresses, mailAddresses, mailAddresses, SENDER_CODE);
    } catch (Throwable t) {
      throw t;
    } finally {
      this._mailManager.updateMailConfig(originaryConfig);
      this.checkOriginaryConfig(originaryConfig);
    }
   
    myFactory2 = null;
    myAuthFactory2 = null;
    smtpServer2.stop();
    smtpServer2 = null;
  }
View Full Code Here

Examples of org.subethamail.smtp.server.SMTPServer

 
  @Override
  protected void setUp() throws Exception {
    this._myFactory = new MockMessageHandlerFactory();
    this._myAuthFactory = new MockAuthenticationHandlerFactory();
    this._smtpServer = new SMTPServer(this._myFactory, this._myAuthFactory);
    this._smtpServer.setPort(25000);
    this._smtpServer.start();
    super.setUp();
  }
View Full Code Here

Examples of org.subethamail.smtp.server.SMTPServer

/** @author Julien Viet */
public class Support {

  protected SMTPServer createServer(MessageHandlerFactory mhf) {
    return new SMTPServer(mhf);
  }
View Full Code Here

Examples of org.subethamail.smtp.server.SMTPServer

    assertResponse(wiser, future);
  }

  public void doTest() throws Exception {
    Wiser wiser = new Wiser();
    SMTPServer smtpServer = createServer(new SimpleMessageListenerAdapter(wiser));
    smtpServer.setHostName("localhost");
    smtpServer.setPort(5000);
    TestPluginLifeCycle lifeCycle = createLifeCycle();
    try {
      lifeCycle.start();
      smtpServer.start();
      execute(lifeCycle, wiser);
    }
    finally {
      smtpServer.stop();
      lifeCycle.stop();
    }
  }
View Full Code Here

Examples of org.subethamail.smtp.server.SMTPServer

        return lifeCycle;
      }

      @Override
      protected SMTPServer createServer(MessageHandlerFactory mhf) {
        SMTPServer smtpServer = super.createServer(mhf);
        smtpServer.setAuthenticationHandlerFactory(new LoginAuthenticationHandlerFactory(new UsernamePasswordValidator() {
          public void login(String username, String password) throws LoginFailedException {
            usernameRef.set(username);
            passwordRef.set(password);
          }
        }));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.