Implement connecting to a server (possibly over SSL)