extract handshake to a method called handshake