Refactor: clean up socket read code

Add helper functions to protocol to make it easier to read into the
correct buffer. Get rid of protocol read length, since it's not needed
after the addition of max_handshake_read_length to protocol.