Socket endpoint

This pull request implements option 2 suggested in issue #311, adding a `SocketEndpoint` class and accessors for remote and local endpoints to the socket implementations `peer.Socket` and `peer.BSDSocket`.