Add more tests and refactor into Peer object for handshake