Fixed "cannot read from closed stream" error.

We have to determine latency (read the first byte) before potentially
serializing/consuming/toString the entity.