Implementando three-way handshake