code: func ReadPacket(r io.Reader) (ControlPacket, error) {
  	var fh FixedHeader
  	b := make([]byte, 1)
  
  	_, err := io.ReadFull(r, b)
  	if err != nil {
  		return nil, err
  	}
  
  	err = fh.unpack(b[0], r)
  	if err != nil {
  		return nil, err
  	}
  
  	cp, err := NewControlPacketWithHeader(fh)
  	if err != nil {
  		return nil, err
  	}
  
  	packetBytes := make([]byte, fh.RemainingLength)
  	n, err := io.ReadFull(r, packetBytes)
  	if err != nil {
  		return nil, err
  	}
  	if n != fh.RemainingLength {
  		return nil, errors.New("Failed to read expected data")
  	}
  
  	err = cp.Unpack(bytes.NewBuffer(packetBytes))
  	return cp, err
  }
docs: //ReadPacket takes an instance of an io.Reader (such as net.Conn) and attempts
  //to read an MQTT packet from the stream. It returns a ControlPacket
  //representing the decoded MQTT packet and an error. One of these returns will
  //always be nil, a nil ControlPacket indicating an error occurred.