{
ReadableByteChannel in = getReadChannel(socket);
while (!isClosed())
{
// receive message
StreamMessage message = StreamMessage.deserialize(in, protocolVersion, session);
// Might be null if there is an error during streaming (see FileMessage.deserialize). It's ok
// to ignore here since we'll have asked for a retry.
if (message != null)
{
logger.debug("[Stream #{}] Received {}", session.planId(), message);