in src/main/java/com/twitter/whiskey/nio/SSLSocket.java [198:229]
boolean doRead(SocketChannel channel) throws IOException {
ByteBuffer out = getBuffer();
int bytesRead = channel.read(bufferedWrapped);
if (bytesRead < 0) {
fail(new IOException("connection closed"));
return true;
}
bufferedWrapped.flip();
SSLEngineResult.Status status = SSLEngineResult.Status.OK;
while (out.remaining() > 0 && bufferedWrapped.remaining() > 0 && status ==
SSLEngineResult.Status.OK) {
SSLEngineResult result = engine.unwrap(bufferedWrapped, out);
status = result.getStatus();
if (result.getHandshakeStatus() != SSLEngineResult.HandshakeStatus.NOT_HANDSHAKING) {
throw new SSLException("renegotiation not supported");
}
}
bufferedWrapped.compact();
out.flip();
set(out);
return true;
}