Move code out of _endpointspy3, in preparation for merging forward.

git-svn-id: svn://svn.twistedmatrix.com/svn/Twisted/branches/connectprotocol-5270@37094 bbbe8e31-12d6-0310-92fd-ac37d47ddeeb