Connecting to FTPS Server with TLS Session Reuse
When attempting to establish a connection with an FTPS server, the client may encounter the "Remote host closed connection during handshake" error. This typically occurs when the server requires the same TLS session to be used for both the control and data connections. Apache Commons Net's FTPS implementation does not inherently support this behavior.
To resolve this issue and ensure TLS session reuse:
Implement Custom FTPSClient:
Override DefaultFtpsSessionFactory:
Handle JDK 8u161 Issue:
Use SessionsByHostAndPort:
Bypass Android SDK Restrictions (Optional):
Remember, this solution is a workaround and may not provide a long-term fix.
The above is the detailed content of How Can I Resolve the 'Remote Host Closed Connection During Handshake' Error When Connecting to an FTPS Server with TLS Session Reuse?. For more information, please follow other related articles on the PHP Chinese website!