MB-11559: Move event handling code to own file

Move connection-related code into new file `connections.`, to allow
memcached.c and thread.c to share event loop code and connection code.

Change-Id: I80bcda990a20b8efe28e1b45e7e386105b838f95
Reviewed-on: http://review.couchbase.org/38969
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>