Package org.apache.commons.net.pop3
Class POP3SClient
java.lang.Object
org.apache.commons.net.SocketClient
org.apache.commons.net.pop3.POP3
org.apache.commons.net.pop3.POP3Client
org.apache.commons.net.pop3.POP3SClient
- Direct Known Subclasses:
- ExtendedPOP3Client
POP3 over SSL processing. Copied from FTPSClient.java and modified to suit POP3. If implicit mode is selected (NOT the default), SSL/TLS negotiation starts
 right after the connection has been established. In explicit mode (the default), SSL/TLS negotiation starts when the user calls execTLS() and the server
 accepts the command. Implicit usage: POP3SClient c = new POP3SClient(true); c.connect("127.0.0.1", 995); Explicit usage: POP3SClient c = new POP3SClient();
 c.connect("127.0.0.1", 110); if (c.execTLS()) { /rest of the commands here/ }
 Warning: the hostname is not verified against the certificate by default, use 
setHostnameVerifier(HostnameVerifier) or
 setEndpointCheckingEnabled(boolean) (on Java 1.7+) to enable verification.- Since:
- 3.0
- 
Field SummaryFields inherited from class org.apache.commons.net.pop3.POP3_commandSupport_, AUTHORIZATION_STATE, DEFAULT_PORT, DISCONNECTED_STATE, TRANSACTION_STATE, UPDATE_STATEFields inherited from class org.apache.commons.net.SocketClient_defaultPort_, _hostname_, _input_, _output_, _serverSocketFactory_, _socket_, _socketFactory_, _timeout_, connectTimeout, NETASCII_EOL, remoteInetSocketAddress
- 
Constructor SummaryConstructorsConstructorDescriptionConstructor for POP3SClient, usingDEFAULT_PROTOCOLi.e.POP3SClient(boolean implicit) Constructor for POP3SClient, usingDEFAULT_PROTOCOLi.e.POP3SClient(boolean implicit, SSLContext ctx) Constructor for POP3SClient, usingDEFAULT_PROTOCOLi.e.POP3SClient(String proto) Constructor for POP3SClient.POP3SClient(String proto, boolean implicit) Constructor for POP3SClient.POP3SClient(String proto, boolean implicit, SSLContext ctx) Constructor for POP3SClient.POP3SClient(SSLContext context) Constructor for POP3SClient, usingDEFAULT_PROTOCOL- TLS - and isImplicit = false
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidBecause there are so many connect() methods, the _connectAction_() method is provided as a means of performing some action immediately after establishing a connection, rather than reimplementing all the connect() methods.booleanexecTLS()The TLS command execution.String[]Returns the names of the cipher suites which could be enabled for use on this connection.String[]Returns the names of the protocol versions which are currently enabled for use on this connection.Gets the currently configuredHostnameVerifier.Gets the currently configuredTrustManager.booleanReturn whether or not endpoint identification using the HTTPS algorithm on Java 1.7+ is enabled.voidsetEnabledCipherSuites(String[] cipherSuites) Controls which particular cipher suites are enabled for use on this connection.voidsetEnabledProtocols(String[] protocolVersions) Controls which particular protocol versions are enabled for use on this connection.voidsetEndpointCheckingEnabled(boolean enable) Automatic endpoint identification checking using the HTTPS algorithm is supported on Java 1.7+.voidsetHostnameVerifier(HostnameVerifier newHostnameVerifier) Override the defaultHostnameVerifierto use.voidsetKeyManager(KeyManager newKeyManager) Sets aKeyManagerto use.voidsetTrustManager(TrustManager newTrustManager) Override the defaultTrustManagerto use.Methods inherited from class org.apache.commons.net.pop3.POP3Clientcapa, deleteMessage, listMessage, listMessages, listUniqueIdentifier, listUniqueIdentifiers, login, login, logout, noop, reset, retrieveMessage, retrieveMessageTop, statusMethods inherited from class org.apache.commons.net.pop3.POP3disconnect, getAdditionalReply, getCommandSupport, getReplyString, getReplyStrings, getState, removeProtocolCommandistener, sendCommand, sendCommand, sendCommand, sendCommand, setStateMethods inherited from class org.apache.commons.net.SocketClientaddProtocolCommandListener, applySocketAttributes, checkOpenOutputStream, connect, connect, connect, connect, connect, connect, createCommandSupport, fireCommandSent, fireReplyReceived, getCharset, getCharsetName, getConnectTimeout, getDefaultPort, getDefaultTimeout, getKeepAlive, getLocalAddress, getLocalPort, getProxy, getReceiveBufferSize, getRemoteAddress, getRemoteInetSocketAddress, getRemotePort, getSendBufferSize, getServerSocketFactory, getSoLinger, getSoTimeout, getTcpNoDelay, isAvailable, isConnected, removeProtocolCommandListener, setCharset, setConnectTimeout, setDefaultPort, setDefaultTimeout, setKeepAlive, setProxy, setReceiveBufferSize, setSendBufferSize, setServerSocketFactory, setSocketFactory, setSoLinger, setSoTimeout, setTcpNoDelay, verifyRemote
- 
Constructor Details- 
POP3SClientpublic POP3SClient()Constructor for POP3SClient, usingDEFAULT_PROTOCOLi.e. TLS Sets security mode to explicit.
- 
POP3SClientConstructor for POP3SClient, usingDEFAULT_PROTOCOLi.e. TLS- Parameters:
- implicit- The security mode,- truefor implicit,- falsefor explicit
 
- 
POP3SClientConstructor for POP3SClient, usingDEFAULT_PROTOCOLi.e. TLS- Parameters:
- implicit- The security mode,- truefor implicit,- falsefor explicit
- ctx- A pre-configured SSL Context.
 
- 
POP3SClientConstructor for POP3SClient, usingDEFAULT_PROTOCOL- TLS - and isImplicit = false- Parameters:
- context- A pre-configured SSL Context.
- See Also:
 
- 
POP3SClientConstructor for POP3SClient. Sets security mode to explicit.- Parameters:
- proto- the protocol.
 
- 
POP3SClientConstructor for POP3SClient.- Parameters:
- proto- the protocol.
- implicit- The security mode,- truefor implicit,- falsefor explicit
 
- 
POP3SClientConstructor for POP3SClient. Sets the default port toDEFAULT_POP3S_PORT- 995 - if using implicit mode- Parameters:
- proto- the protocol.
- implicit- The security mode,- truefor implicit,- falsefor explicit
- ctx- the context to be used
 
 
- 
- 
Method Details- 
_connectAction_Because there are so many connect() methods, the _connectAction_() method is provided as a means of performing some action immediately after establishing a connection, rather than reimplementing all the connect() methods.- Overrides:
- _connectAction_in class- POP3
- Throws:
- IOException- If it is thrown by _connectAction_().
- See Also:
 
- 
execTLSThe TLS command execution.- Returns:
- TRUE if the command and negotiation succeeded.
- Throws:
- SSLException- If the server reply code is not positive.
- IOException- If an I/O error occurs while sending the command or performing the negotiation.
 
- 
getEnabledCipherSuitesReturns the names of the cipher suites which could be enabled for use on this connection. When the underlyingSocketis not anSSLSocketinstance, returns null.- Returns:
- An array of cipher suite names, or null.
 
- 
getEnabledProtocolsReturns the names of the protocol versions which are currently enabled for use on this connection. When the underlyingSocketis not anSSLSocketinstance, returns null.- Returns:
- An array of protocols, or null.
 
- 
getHostnameVerifierGets the currently configuredHostnameVerifier.- Returns:
- A HostnameVerifier instance.
- Since:
- 3.4
 
- 
getTrustManagerGets the currently configuredTrustManager.- Returns:
- A TrustManager instance.
 
- 
isEndpointCheckingEnabledReturn whether or not endpoint identification using the HTTPS algorithm on Java 1.7+ is enabled. The default behavior is for this to be disabled.- Returns:
- True if enabled, false if not.
- Since:
- 3.4
 
- 
setEnabledCipherSuitesControls which particular cipher suites are enabled for use on this connection. Called before server negotiation.- Parameters:
- cipherSuites- The cipher suites.
 
- 
setEnabledProtocolsControls which particular protocol versions are enabled for use on this connection. I perform setting before a server negotiation.- Parameters:
- protocolVersions- The protocol versions.
 
- 
setEndpointCheckingEnabledAutomatic endpoint identification checking using the HTTPS algorithm is supported on Java 1.7+. The default behavior is for this to be disabled.- Parameters:
- enable- Enable automatic endpoint identification checking using the HTTPS algorithm on Java 1.7+.
- Since:
- 3.4
 
- 
setHostnameVerifierOverride the defaultHostnameVerifierto use.- Parameters:
- newHostnameVerifier- The HostnameVerifier implementation to set or- nullto disable.
- Since:
- 3.4
 
- 
setKeyManagerSets aKeyManagerto use.- Parameters:
- newKeyManager- The KeyManager implementation to set.
- See Also:
 
- 
setTrustManagerOverride the defaultTrustManagerto use.- Parameters:
- newTrustManager- The TrustManager implementation to set.
- See Also:
 
 
-