Package org.apache.commons.net.pop3

Examples of org.apache.commons.net.pop3.POP3MessageInfo


    @Test
    public void testIpStored() throws Exception {

        finishSetUp(pop3Configuration);

        pop3Client = new POP3Client();
        pop3Client.connect("127.0.0.1", pop3Port);

        String pass = "password";
        usersRepository.addUser("foo", pass);
View Full Code Here


    @Test
    public void testCapa() throws Exception {
        finishSetUp(pop3Configuration);

        pop3Client = new POP3Client();
        pop3Client.connect("127.0.0.1", pop3Port);

        String pass = "password";
        usersRepository.addUser("foo", pass);
View Full Code Here

    // See JAMES-1136
    @Test
    public void testDeadlockOnRetr() throws Exception {
        finishSetUp(pop3Configuration);

        pop3Client = new POP3Client();
        pop3Client.connect("127.0.0.1", pop3Port);

        usersRepository.addUser("foo6", "bar6");
        MailboxSession session = mailboxManager.login("foo6", "bar6", LoggerFactory.getLogger("Test"));
View Full Code Here

           
            factory.add("valid", new MockMailbox(identifier));
            server = createServer(createProtocol(factory), address);
            server.bind();
           
            POP3Client client =  createClient();
            client.connect(address.getAddress().getHostAddress(), address.getPort());
           
            assertTrue(client.login("valid", "valid"));
            assertTrue(client.noop());
            assertTrue(client.logout());
          
        } finally {
            if (server != null) {
                server.unbind();
            }
View Full Code Here

           
            factory.add("valid", new MockMailbox(identifier, MESSAGE1));
            server = createServer(createProtocol(factory), address);
            server.bind();
           
            POP3Client client =  createClient();
            client.connect(address.getAddress().getHostAddress(), address.getPort());
           
            assertTrue(client.login("valid", "valid"));
            assertEquals(1, client.listMessages().length);
            assertTrue(client.deleteMessage(1));
            assertEquals(0, client.listMessages().length);
           
            // call RSET. After this the deleted mark should be removed again
            assertTrue(client.reset());
            assertEquals(1, client.listMessages().length);

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

           
            factory.add("valid", new MockMailbox(identifier, MESSAGE1, MESSAGE2));
            server = createServer(createProtocol(factory), address);
            server.bind();
           
            POP3Client client =  createClient();
            client.connect(address.getAddress().getHostAddress(), address.getPort());
           
            assertTrue(client.login("valid", "valid"));
            POP3MessageInfo info = client.status();
            assertEquals((int)(MESSAGE1.meta.getSize() + MESSAGE2.meta.getSize()), info.size);
            assertEquals(2, info.number);
           
            assertTrue(client.logout());
          
        } finally {
            if (server != null) {
                server.unbind();
            }
View Full Code Here

           
            factory.add("valid", new MockMailbox(identifier, MESSAGE1, MESSAGE2));
            server = createServer(createProtocol(factory), address);
            server.bind();
           
            POP3Client client =  createClient();
           
            client.connect(address.getAddress().getHostAddress(), address.getPort());
            assertNull(client.listMessages());
            assertNull(client.listUniqueIdentifiers());
            assertFalse(client.deleteMessage(1));
            assertNull(client.retrieveMessage(1));
            assertNull(client.retrieveMessageTop(1, 10));
            assertNull(client.status());
            assertFalse(client.reset());
            client.logout();
           
            client.connect(address.getAddress().getHostAddress(), address.getPort());

            assertTrue(client.login("valid", "valid"));
            assertNotNull(client.listMessages());
            assertNotNull(client.listUniqueIdentifiers());
            Reader reader = client.retrieveMessage(1);
            assertNotNull(reader);
            reader.close();
            assertNotNull(client.status());
            reader = client.retrieveMessageTop(1, 1);
            assertNotNull(reader);
            reader.close();
            assertTrue(client.deleteMessage(1));
            assertTrue(client.reset());

            assertTrue(client.logout());

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

        try {
            TestApopCmdHandler handler = new TestApopCmdHandler();
            server = createServer(createProtocol(handler), address);
            server.bind();
           
            POP3Client client =  createClient();
            client.connect(address.getAddress().getHostAddress(), address.getPort());
            String welcomeMessage = client.getReplyString();
           
            // check for valid syntax that include all info needed for APOP
            assertTrue(welcomeMessage.trim().matches("\\+OK \\<\\d+\\.\\d+@.+\\> .+"));
           
            int reply = client.sendCommand("APOP invalid invalid");
            assertEquals(POP3Reply.ERROR, reply);
           
            handler.add("valid", new MockMailbox("id"));
            reply = client.sendCommand("APOP valid valid");
            assertEquals(POP3Reply.OK, reply);
           
            assertTrue(client.logout());
          
        } finally {
            if (server != null) {
                server.unbind();
            }
View Full Code Here

    }
   
    protected abstract ProtocolServer createServer(Protocol protocol, InetSocketAddress address);
   
    protected POP3Client createClient() {
        return new POP3Client();
    }
View Full Code Here

        ProtocolServer server = null;
        try {
            server = createServer(createProtocol(new TestPassCmdHandler()), address);
            server.bind();
           
            POP3Client client =  createClient();
            client.connect(address.getAddress().getHostAddress(), address.getPort());
           
            assertFalse(client.login("invalid", "invalid"));
          
            assertTrue(client.logout());
          
        } finally {
            if (server != null) {
                server.unbind();
            }
View Full Code Here

TOP

Related Classes of org.apache.commons.net.pop3.POP3MessageInfo

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.