move connection handling to its own module

This change move the socket connection to its own module. Also it is
introducing the create_connection/4 function so we can distinct it later
from the connect function.

Note: for now connect/4 is a wrapper to create_connection/4 waiting the
new API.