'Secured FTP Close call hanging

I'm connecting to an FTP site using Secured FTP, TLSv1.2, clientMode == 2 in a Java Spring app using spring-integration-ftp-2.2.3.RELEASE. I'm connecting using the DefaultFtpsSessionFactory. It connects ok, and I can issue a write() to transfer a file. This all works correctly.

In a finally {} block I've got a session.close() coded. When I issue this, I never get a reply back -- the app hangs and does not timeout. I've got the following coded for timeouts when instantiating the class:

    protected void postProcessClientBeforeConnect(FTPSClient client) throws IOException {

        //Set the timeouts through this Spring-provided hook method.
        client.setDataTimeout(60000);
        client.setDefaultTimeout(60000);
    }

And the following is my close logic:

            if (session.isOpen()) {
                session.close();
            }

If I run with javax.net.debug=all, I get the following when I issue the close():

main, called closeInternal(true)
main, SEND TLSv1.2 ALERT:  warning, description = close_notify
Padded plaintext before ENCRYPTION:  len = 64
0000: ...
{...snipped...}
0030: CE 49 0D 0D 0D 0D 0D 0D   0D 0D 0D 0D 0D 0D 0D 0D  .I..............
main, WRITE: TLSv1.2 Alert, length = 64
[Raw write]: length = 69
0000: ....
{ ...snipped... }
0040: 48 26 BB 50 DF                                     H&.P.
main, called closeSocket(selfInitiated)
main, waiting for close_notify or alert: state 5

Any idea why the close() won't return? Or perhaps any ideas about how I can set a timeout on the close()?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source