code: func readMessage(r io.Reader, lengthReader lengthReader) ([]byte, error) {
  	var err error
  
  	length, err := lengthReader(r)
  	if err != nil {
  		return nil, err
  	}
  
  	data := make([]byte, length)
  	n, err := io.ReadFull(r, data)
  
  	if err != nil && err != io.ErrUnexpectedEOF {
  		return data, errors.WrapErrorf(err, errors.NetworkError, "error reading message data")
  	} else if err == io.ErrUnexpectedEOF {
  		return data, errIncompleteMessage("message data", n, length)
  	}
  	return data, nil
  }
docs: // readMessage reads a length from r, then reads length bytes and returns them.
  // lengthReader is the function used to read the length. Most operations encode
  // length as a hex string (readHexLength), but sync operations use little-endian
  // binary encoding (readInt32).