Fix two more bugs.

Unfortunately, two more subtle bugs to fix:

- If the encoded protobuf message is only three bytes long (or less),
  not only the whole protobuf will fit into headerBuf, but also the
  beginning of the next length varint. This will completely wreak
  havoc in the read process. (This bug never bit us in Prometheus
  because the protobuf messages were all long enough. But protobufs in
  general can be very small (0 bytes in fact). I added a test for
  that.)

- If the reader stops in the middle of a length varint, it will
  interpret the null byte that is already in headerBuf as the final
  byte of the varint, which again wreaks havoc. (This bug only shows
  up in Prometheus after
  https://github.com/prometheus/prometheus/commit/dfb9c2a072d5c1003e78c4921988c21bc76ab07a
  , and it is very rare... needs very unlucky fragmentation on the
  network.)

Solution to the first bug is to read byte-wise, which is slightly less
effective, but simplifies the code later, because we don't "overshoot"
anymore. Solution to the second bug is to only read the parts of
headerBuf that have been written to.
Just looking at this here:

We only check for an error on read if ``newBytesRead == 0``.  This is incorrect.  Can we move this ``if err != nil {}`` to prior to this ``if newBytesRead == 0`` branch?