@Override public int read(ByteBuffer dst) throws IOException {
            int drainResult = drain(dst);
            if (drainResult != 0) {
                return drainResult;
            }
            return super.read(dst);
        }
A crypto socket for the server side of a connection that
auto-detects whether the connection is tls encrypted or unencrypted
using clever heuristics. The assumption is that the client side
will send at least one RPC request before expecting anything from
the server. The first 9 bytes are inspected to see if they look
like part of a tls handshake or not (RPC packet headers are 12
bytes).
jrt/src/com/yahoo/jrt/MaybeTlsCryptoSocket.java