Use heap buffers for MessageToByteEncoders

same as above. Maybe we could even have this in a static helper method and share it between these two classes.