I'm leaving the getsockname code in transproxy alone, since it is comparatively isolated, rather platform-specific, and hard to test. Implements 18105.