Package org.apache.james.smtpserver

Examples of org.apache.james.smtpserver.POP3BeforeSMTPHandler


        };
    }

    public void testAuthWorks() {

        POP3BeforeSMTPHandler handler = new POP3BeforeSMTPHandler();

        setupMockedSMTPSession();
        POP3BeforeSMTPHelper.addIPAddress("192.168.200.1");

        assertFalse(mockedSession.isRelayingAllowed());
        handler.onConnect(mockedSession);
        assertTrue(mockedSession.isRelayingAllowed());
    }
View Full Code Here


        assertTrue(mockedSession.isRelayingAllowed());
    }

    public void testIPGetRemoved() {
        long sleepTime = 100;
        POP3BeforeSMTPHandler handler = new POP3BeforeSMTPHandler();

        setupMockedSMTPSession();
        POP3BeforeSMTPHelper.addIPAddress("192.168.200.1");
        assertFalse(mockedSession.isRelayingAllowed());

        try {
            Thread.sleep(sleepTime);
            POP3BeforeSMTPHelper.removeExpiredIP(10);
            handler.onConnect(mockedSession);
            assertFalse(mockedSession.isRelayingAllowed());

        } catch (InterruptedException e) {
            //ignore
        }
View Full Code Here

        }
    }
   
    public void testThrowExceptionOnIllegalExpireTime() {
        boolean exception = false;
        POP3BeforeSMTPHandler handler = new POP3BeforeSMTPHandler();

        setupMockedSMTPSession();    

        try {
            handler.setExpireTime("1 unit");
        } catch (NumberFormatException e) {
            exception = true;
        }
        assertTrue(exception);
    }
View Full Code Here

        assertTrue(exception);
    }
   
    public void testValidExpireTime() {
        boolean exception = false;
        POP3BeforeSMTPHandler handler = new POP3BeforeSMTPHandler();

        setupMockedSMTPSession();    

        try {
            handler.setExpireTime("1 hour");
        } catch (NumberFormatException e) {
            exception = true;
        }
        assertFalse(exception);
    }
View Full Code Here

TOP

Related Classes of org.apache.james.smtpserver.POP3BeforeSMTPHandler

Copyright © 2018 www.massapicom. 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.