Examples of SMTPSession


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

public class MaxUnknownCmdHandlerTest extends TestCase{

   
    public void testRejectAndClose() throws ParseException {
        SMTPSession session = new BaseFakeSMTPSession() {
            private final HashMap<String,Object> state = new HashMap<String,Object>();

            public Map<String,Object> getState() {
                return state;
            }
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

        };
        return dns;
    }
   
    private SMTPSession setupMockedSession(final MailAddress sender) {
        SMTPSession session = new BaseFakeSMTPSession() {
            HashMap<String,Object> state = new HashMap<String,Object>();

            public Map<String,Object> getState() {

                state.put(SMTPSession.SENDER, sender);
View Full Code Here

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

        assertEquals("Not blocked cause its a nullsender",response,HookReturnCode.DECLINED);
    }

    public void testInvalidSenderDomainReject() throws ParseException {
        ValidSenderDomainHandler handler = new ValidSenderDomainHandler();
        SMTPSession session = setupMockedSession(new MailAddress("invalid@invalid"));
        handler.setDNSService(setupDNSServer());
        int response = handler.doMail(session,(MailAddress) session.getState().get(SMTPSession.SENDER)).getResult();
       
        assertEquals("Blocked cause we use reject action", response,HookReturnCode.DENY);
    }
View Full Code Here

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


public class MaxRcptHandlerTest extends TestCase{
   
    private SMTPSession setupMockedSession(final int rcptCount) {
        SMTPSession session = new BaseFakeSMTPSession() {
            HashMap<String,Object> state = new HashMap<String,Object>();

            public Map<String,Object> 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.