This commit fix #79.

Implements the third step of handshake.

Signed-off-by: Ivo Calado <txithihausen@gmail.com>
Signed-off-by: João Correia <lucaskm98@gmail.com>