This commit fix #77

Implements the second phase of connection: server handling
Signed-off-by: Ivo Calado <txithihausen@gmail.com>
Signed-off-by: João Correia <lucaskm98@gmail.com>