Examples of SMTPSession


Examples of org.apache.james.protocols.smtp.SMTPSession

        int port = TestUtil.getNonPrivilegedPort();
        MockSpamd spamd = new MockSpamd(port);
        new Thread(spamd).start();

        SMTPSession session = setupMockedSMTPSession(setupMockedMail(setupMockedMimeMessage("test")));

        SpamAssassinHandler handler = new SpamAssassinHandler();

        handler.setSpamdHost(SPAMD_HOST);
        handler.setSpamdPort(port);
View Full Code Here

Examples of org.apache.james.protocols.smtp.SMTPSession

    public void testSpam() throws IOException, MessagingException {

        int port = TestUtil.getNonPrivilegedPort();
        new Thread(new MockSpamd(port)).start();

        SMTPSession session = setupMockedSMTPSession(setupMockedMail(setupMockedMimeMessage(MockSpamd.GTUBE)));

        SpamAssassinHandler handler = new SpamAssassinHandler();

        handler.setSpamdHost(SPAMD_HOST);
        handler.setSpamdPort(port);
View Full Code Here

Examples of org.apache.james.protocols.smtp.SMTPSession

    public void testSpamReject() throws IOException, MessagingException {

        int port = TestUtil.getNonPrivilegedPort();
        new Thread(new MockSpamd(port)).start();

        SMTPSession session = setupMockedSMTPSession(setupMockedMail(setupMockedMimeMessage(MockSpamd.GTUBE)));

        SpamAssassinHandler handler = new SpamAssassinHandler();

        handler.setSpamdHost(SPAMD_HOST);
        handler.setSpamdPort(port);
View Full Code Here

Examples of org.apache.james.protocols.smtp.SMTPSession

           
        });
    }

    private SMTPSession setupMockedSMTPSession(final SMTPConfiguration conf, final MailAddress rcpt, final boolean relayingAllowed) {
        SMTPSession session = new BaseFakeSMTPSession() {
            HashMap<String,Object> state = new HashMap<String,Object>();

            public boolean isRelayingAllowed() {
                return relayingAllowed;
            }
View Full Code Here

Examples of org.apache.james.protocols.smtp.SMTPSession

        return conf;
    }
   
    public void testRejectInvalidUser() throws Exception {
        MailAddress mailAddress = new MailAddress(INVALID_USER + "@localhost");
        SMTPSession session = setupMockedSMTPSession(setupMockedSMTPConfiguration(),mailAddress,false);
   
        int rCode = handler.doRcpt(session, null, mailAddress).getResult();
   
        assertEquals("Rejected",rCode,HookReturnCode.DENY);
    }
View Full Code Here

Examples of org.apache.james.protocols.smtp.SMTPSession

        assertEquals("Rejected",rCode,HookReturnCode.DENY);
    }
   
    public void testNotRejectInvalidUserRelay() throws Exception {
        MailAddress mailAddress = new MailAddress(INVALID_USER + "@localhost");
        SMTPSession session = setupMockedSMTPSession(setupMockedSMTPConfiguration(),mailAddress,true);

        int rCode = handler.doRcpt(session, null, mailAddress).getResult();
       
        assertEquals("Not rejected",rCode,HookReturnCode.DECLINED);
    }
View Full Code Here

Examples of org.apache.james.protocols.smtp.SMTPSession

        assertEquals("Not rejected",rCode,HookReturnCode.DECLINED);
    }
   
    public void testNotRejectValidUser() throws Exception {
        MailAddress mailAddress = new MailAddress(VALID_USER + "@localhost");
        SMTPSession session = setupMockedSMTPSession(setupMockedSMTPConfiguration(),mailAddress,false);
   
        int rCode = handler.doRcpt(session, null, mailAddress).getResult();
       
        assertEquals("Not rejected",rCode,HookReturnCode.DECLINED);
    }
View Full Code Here

Examples of org.apache.james.protocols.smtp.SMTPSession

        assertEquals("Not rejected",rCode,HookReturnCode.DECLINED);
    }
 
    public void testHasAddressMapping() throws Exception {
        MailAddress mailAddress = new MailAddress(USER1 + "@localhost");
        SMTPSession session = setupMockedSMTPSession(setupMockedSMTPConfiguration(),mailAddress,false);
   
        int rCode = handler.doRcpt(session, null, mailAddress).getResult();
       
        assertEquals("Not rejected",rCode,HookReturnCode.DECLINED);
    }
View Full Code Here

Examples of org.apache.james.protocols.smtp.SMTPSession

        assertEquals("Not rejected",rCode,HookReturnCode.DECLINED);
    }
   
    public void testHasErrorMapping() throws Exception {
        MailAddress mailAddress = new MailAddress(USER2 + "@localhost");
        SMTPSession session = setupMockedSMTPSession(setupMockedSMTPConfiguration(),mailAddress,false);

        int rCode = handler.doRcpt(session, null,mailAddress).getResult();
   
        assertNull("Valid Error mapping",session.getState().get("VALID_USER"));
        assertEquals("Error mapping",rCode, HookReturnCode.DENY);
    }
View Full Code Here

Examples of org.apache.james.protocols.smtp.SMTPSession

    private final static String INVALID_MX = "mx." + INVALID_HOST;

    private final static String LOOPBACK = "127.0.0.1";

    private SMTPSession setupMockedSMTPSession(final MailAddress rcpt) {
        SMTPSession session = new BaseFakeSMTPSession() {
            HashMap state = new HashMap();
           
            public Map getState() {
                return state;
            }
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.