@Override
    @SuppressWarnings("Finalize")
    protected void finalize() throws Throwable {
        try {
            // If ssl is null, object must not be fully constructed so nothing for us to do here.
            if (ssl != null) {
                // Otherwise closeAndFreeResources() and callees expect to synchronize on ssl.
                synchronized (ssl) {
                    closeAndFreeResources();
                }
            }
        } finally {
            super.finalize();
        }
    }
Read encrypted data from the OpenSSL network BIO
common/src/main/java/org/conscrypt/ConscryptEngine.java