@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); final Store store = session.getStore("pop3"); try { store.connect("test", "test"); final Folder folder = store.getFolder("INBOX"); folder.open(Folder.READ_ONLY); assertFalse(folder.isOpen()); } finally { store.close(); } } catch (final Exception e) { e.printStackTrace(); fail(e.getMessage()); } finally { if (server != null) { server.quit(); } } }
public synchronized boolean isConnected() { if (!super.isConnected()) return false; try { if (port == null) port = getPort(null); else if (!port.noop()) throw new IOException("NOOP failed"); return true; } catch (IOException ioex) { try { super.close(); } catch (MessagingException mex) { } finally { return false; } } }
POP3Store extends Store { public synchronized boolean isConnected() { if (!super.isConnected()) return false; try { if (port == null) port = getPort(null); else if (!port.noop()) throw new IOException("NOOP failed"); return true; } catch (IOException ioex) { try { super.close(); } catch (MessagingException mex) { } finally { return false; } } } }
POP3Store extends Store { public synchronized boolean isConnected() { if (!super.isConnected()) return false; try { if (port == null) port = getPort(null); else if (!port.noop()) throw new IOException("NOOP failed"); return true; } catch (IOException ioex) { try { super.close(); } catch (MessagingException mex) { } finally { return false; } } } POP3Store(Session session, URLName url);  POP3Store(Session session, URLName url,
				String name, boolean isSSL); }
POP3Store extends Store { public synchronized boolean isConnected() { if (!super.isConnected()) return false; try { if (port == null) port = getPort(null); else if (!port.noop()) throw new IOException("NOOP failed"); return true; } catch (IOException ioex) { try { super.close(); } catch (MessagingException mex) { } finally { return false; } } } POP3Store(Session session, URLName url);  POP3Store(Session session, URLName url,
				String name, boolean isSSL); synchronized boolean isConnected(); synchronized void close(); Folder getDefaultFolder(); Folder getFolder(String name); Folder getFolder(URLName url); Map capabilities(); synchronized boolean isSSL(); }
POP3Store extends Store { public synchronized boolean isConnected() { if (!super.isConnected()) return false; try { if (port == null) port = getPort(null); else if (!port.noop()) throw new IOException("NOOP failed"); return true; } catch (IOException ioex) { try { super.close(); } catch (MessagingException mex) { } finally { return false; } } } POP3Store(Session session, URLName url);  POP3Store(Session session, URLName url,
				String name, boolean isSSL); synchronized boolean isConnected(); synchronized void close(); Folder getDefaultFolder(); Folder getFolder(String name); Folder getFolder(URLName url); Map capabilities(); synchronized boolean isSSL();  }