@Override
  public ChannelOutput receive() throws IOException {
    if (!connected) {
      throw new ClosedChannelException();
    }

    // consume the size header and return the remaining response.
    ByteBuffer streamSizeBuffer = ByteBuffer.allocate(8);
    while (streamSizeBuffer.position() < streamSizeBuffer.capacity()) {
      int read = readChannel.read();
      if (read == -1) {
        throw new IOException("Could not read complete size from readChannel ");
      }
      streamSizeBuffer.put((byte) read);
    }
    streamSizeBuffer.flip();
    return new ChannelOutput(new DataInputStream(readChannel), streamSizeBuffer.getLong() - 8);
  }
Sets socket options to close immediately
(subsequent Socket.close() will cause connection closure by sending TCP RST instead of FIN
ambry-network/src/main/java/com/github/ambry/network/BlockingChannel.java