Make connection type more abstract

The Connection type doesn't need to care about sockets or socket addresses -- this will make it easier to mock connections, use SSL, etc.