Factorize read/write, handshake now uses a single read