@Test
public void testIsConnected() {

    TestServer server = null;
    try {
        final POP3Handler handler = new POP3HandlerNoopErr();
        server = new TestServer(handler);
        server.start();
        Thread.sleep(1000);
        
        final Properties properties = new Properties();
        properties.setProperty("mail.pop3.host", "localhost");
        properties.setProperty("mail.pop3.port", "" + server.getPort());
        final Session session = Session.getInstance(properties);
        //session.setDebug(true);
        
        final Store store = session.getStore("pop3");
        try {
            store.connect("test", "test");
            final Folder folder = store.getFolder("INBOX");
            folder.open(Folder.READ_ONLY);
            
            // Check
            assertFalse(folder.isOpen());
        } finally {
            store.close();
        }
    } catch (final Exception e) {
        e.printStackTrace();
        fail(e.getMessage());
    } finally {
        if (server != null) {
            server.quit();
        }
    }
}