Examples of SMTPSClient


Examples of org.apache.commons.net.smtp.SMTPSClient

import org.junit.Test;

public abstract class AbstractStartTlsSMTPServerTest {
   
    protected SMTPSClient createClient() {
        SMTPSClient client = new SMTPSClient(false, BogusSslContextFactory.getClientContext());
        client.setTrustManager(BogusTrustManagerFactory.getTrustManagers()[0]);
        return client;
    }
View Full Code Here

Examples of org.apache.commons.net.smtp.SMTPSClient

        ProtocolServer server = null;
        try {
            server = createServer(createProtocol(new ProtocolHandler[0]), address, Encryption.createStartTls(BogusSslContextFactory.getServerContext()))
            server.bind();
           
            SMTPSClient client = createClient();
            client.connect(address.getAddress().getHostAddress(), address.getPort());
            assertTrue(SMTPReply.isPositiveCompletion(client.getReplyCode()));
           
            client.sendCommand("EHLO localhost");
            assertTrue(SMTPReply.isPositiveCompletion(client.getReplyCode()));
           
            boolean startTLSAnnounced = false;
            for (String reply: client.getReplyStrings()) {
                if (reply.toUpperCase(Locale.UK).endsWith("STARTTLS")) {
                    startTLSAnnounced = true;
                    break;
                }
            }
            assertTrue(startTLSAnnounced);
           
            assertTrue(client.execTLS());
           
            // TODO: Add back once commons-net 3.1.0 was released.
            // See: NET-421
            //
            //client.quit();
            //assertTrue("Reply="+ client.getReplyString(), SMTPReply.isPositiveCompletion(client.getReplyCode()));
           
            client.disconnect();


        } finally {
            if (server != null) {
                server.unbind();
View Full Code Here

Examples of org.apache.commons.net.smtp.SMTPSClient

public abstract class AbstractSMTPSServerTest extends AbstractSMTPServerTest{
   
   
    @Override
    protected SMTPClient createClient() {
        SMTPSClient client = new SMTPSClient(true,BogusSslContextFactory.getClientContext());
        client.setTrustManager(BogusTrustManagerFactory.getTrustManagers()[0]);
        return client;
    }
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.