@Override public synchronized void closeInbound() throws SSLException { if (isInboundDone) { return; } isInboundDone = true; engineClosed = true; if (accepted != 0) { if (!receivedShutdown) { shutdown(); throw new SSLException("close_notify has not been received"); } } else { // engine closing before initial handshake shutdown(); } }
@Override public synchronized void closeOutbound() { if (isOutboundDone) { return; } isOutboundDone = true; engineClosed = true; if (accepted != 0 && destroyed == 0) { int mode = SSL.getShutdown(ssl); if ((mode & SSL.SSL_SENT_SHUTDOWN) != SSL.SSL_SENT_SHUTDOWN) { SSL.shutdownSSL(ssl); } } else { // engine closing before initial handshake shutdown(); } }
@Override protected void finalize() throws Throwable { sslEngine.shutdown(); super.finalize(); } };