MCPcopy Create free account
hub / github.com/M66B/FairEmail / isConnected

Method isConnected

app/src/main/java/com/sun/mail/imap/IMAPStore.java:1713–1749  ·  view source on GitHub ↗

Check whether this store is connected. Override superclass method, to actually ping our server connection.

()

Source from the content-addressed store, hash-verified

1711 * method, to actually ping our server connection.
1712 */
1713 @Override
1714 public synchronized boolean isConnected() {
1715 if (!super.isConnected()) {
1716 // if we haven't been connected at all, don't bother with
1717 // the NOOP.
1718 return false;
1719 }
1720
1721 /*
1722 * The below noop() request can:
1723 * (1) succeed - in which case all is fine.
1724 *
1725 * (2) fail because the server returns NO or BAD, in which
1726 * case we ignore it since we can't really do anything.
1727 * (2) fail because a BYE response is obtained from the
1728 * server
1729 * (3) fail because the socket.write() to the server fails,
1730 * in which case the iap.protocol() code converts the
1731 * IOException into a BYE response.
1732 *
1733 * Thus, our BYE handler will take care of closing the Store
1734 * in case our connection is really gone.
1735 */
1736
1737 IMAPProtocol p = null;
1738 try {
1739 p = getStoreProtocol("isConnected");
1740 p.noop();
1741 } catch (ProtocolException pex) {
1742 // will return false below
1743 } finally {
1744 releaseStoreProtocol(p);
1745 }
1746
1747
1748 return super.isConnected();
1749 }
1750
1751 /**
1752 * Close this Store.

Callers 2

cleanupMethod · 0.45
checkConnectedMethod · 0.45

Calls 3

getStoreProtocolMethod · 0.95
noopMethod · 0.95
releaseStoreProtocolMethod · 0.95

Tested by

no test coverage detected