@Override
    public int read(ByteBuffer dst) throws IOException {
        verifyHandshakeCompleted();
        int bytesUnwrapped = drain(dst);
        if (bytesUnwrapped > 0) return bytesUnwrapped;

        int bytesRead = channelRead();
        if (bytesRead == 0) return 0;
        return drain(dst);
    }
A {@link CryptoSocket} using TLS ({@link SSLEngine})

@author bjorncs
jrt/src/com/yahoo/jrt/TlsCryptoSocket.java