Examples of SMTPSession


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

        };
        return session;
    }
   
    public void testRejectMaxRcpt() throws ParseException {
        SMTPSession session = setupMockedSession(3);
        MaxRcptHandler handler = new MaxRcptHandler();
       
        handler.setMaxRcpt(2);
        int resp = handler.doRcpt(session,null,new MailAddress("test@test")).getResult();
   
View Full Code Here

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

        assertEquals("Rejected.. To many recipients", resp, HookReturnCode.DENY);
    }
 
   
    public void testNotRejectMaxRcpt() throws ParseException {
        SMTPSession session = setupMockedSession(3);
        MaxRcptHandler handler = new MaxRcptHandler();   

        handler.setMaxRcpt(4);
        int resp = handler.doRcpt(session,null,new MailAddress("test@test")).getResult();
       
View Full Code Here

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


    private SMTPSession setupMockSession(final String argument,
             final boolean relaying, final boolean authRequired, final String user, final MailAddress recipient) {
       
        SMTPSession session = new BaseFakeSMTPSession() {

            HashMap<String,Object> connectionMap = new HashMap<String,Object>();
            HashMap<String,Object> map = new HashMap<String,Object>();
           
            public boolean isAuthSupported() {
View Full Code Here

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

        return dns;
    }
   
    public void testRejectInvalidHelo() throws ParseException {
        MailAddress mailAddress = new MailAddress("test@localhost");
        SMTPSession session = setupMockSession(INVALID_HOST,false,false,null,mailAddress);
        ResolvableEhloHeloHandler handler = new ResolvableEhloHeloHandler();
        handler.setDNSService(setupMockDNSServer());
       
        handler.doHelo(session, INVALID_HOST);
        assertNotNull("Invalid HELO",session.getState().get(ResolvableEhloHeloHandler.BAD_EHLO_HELO));
       
        int result = handler.doRcpt(session,null, mailAddress).getResult();
        assertEquals("Reject", result,HookReturnCode.DENY);
    }
View Full Code Here

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

    }
   
   
    public void testNotRejectValidHelo() throws ParseException {
        MailAddress mailAddress = new MailAddress("test@localhost");
        SMTPSession session = setupMockSession(VALID_HOST,false,false,null,mailAddress);
        ResolvableEhloHeloHandler handler = new ResolvableEhloHeloHandler();
               
        handler.setDNSService(setupMockDNSServer());
 
        handler.doHelo(session, VALID_HOST);
        assertNull("Valid HELO",session.getState().get(ResolvableEhloHeloHandler.BAD_EHLO_HELO));

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

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

    }
  
   
    public void testRejectInvalidHeloAuthUser() throws ParseException {
        MailAddress mailAddress = new MailAddress("test@localhost");
        SMTPSession session = setupMockSession(INVALID_HOST,false,true,"valid@user",mailAddress);
        ResolvableEhloHeloHandler handler = new ResolvableEhloHeloHandler();
               
        handler.setDNSService(setupMockDNSServer());

        handler.doHelo(session, INVALID_HOST);
        assertNotNull("Value stored",session.getState().get(ResolvableEhloHeloHandler.BAD_EHLO_HELO));
       
       
        int result = handler.doRcpt(session,null, mailAddress).getResult();
        assertEquals("Reject", result,HookReturnCode.DENY);
    }
View Full Code Here

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

   
  
   
    public void testRejectRelay() throws ParseException {
        MailAddress mailAddress = new MailAddress("test@localhost");
        SMTPSession session = setupMockSession(INVALID_HOST,true,false,null,mailAddress);
        ResolvableEhloHeloHandler handler = new ResolvableEhloHeloHandler();
       
       
        handler.setDNSService(setupMockDNSServer());

        handler.doHelo(session, INVALID_HOST);
        assertNotNull("Value stored",session.getState().get(ResolvableEhloHeloHandler.BAD_EHLO_HELO));
       
       
        int result = handler.doRcpt(session,null, mailAddress).getResult();
        assertEquals("Reject", result,HookReturnCode.DENY);
    }
View Full Code Here

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

    public void testNotBlocked() throws IOException, MessagingException {
       
        ArrayList servers = new ArrayList();
        servers.add(URISERVER);
       
        SMTPSession session = setupMockedSMTPSession(setupMockedMail(setupMockedMimeMessage("http://" + GOOD_DOMAIN + "/")));

        URIRBLHandler handler = new URIRBLHandler();

        handler.setDNSService(setupMockedDnsServer());
        handler.setUriRblServer(servers);
View Full Code Here

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

    public void testBlocked() throws IOException, MessagingException {
       
        ArrayList servers = new ArrayList();
        servers.add(URISERVER);
       
        SMTPSession session = setupMockedSMTPSession(setupMockedMail(setupMockedMimeMessage("http://" + BAD_DOMAIN1 + "/")));

        URIRBLHandler handler = new URIRBLHandler();

        handler.setDNSService(setupMockedDnsServer());
        handler.setUriRblServer(servers);
View Full Code Here

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

    public void testBlockedMultiPart() throws IOException, MessagingException {
       
        ArrayList servers = new ArrayList();
        servers.add(URISERVER);
       
        SMTPSession session = setupMockedSMTPSession(setupMockedMail(setupMockedMimeMessageMP("http://" + BAD_DOMAIN1 + "/" + " " +"http://" + GOOD_DOMAIN + "/")));

        URIRBLHandler handler = new URIRBLHandler();

        handler.setDNSService(setupMockedDnsServer());
        handler.setUriRblServer(servers);
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.