Simplify ConnectHelper.ConnectAsync to just return Stream (dotnet/corefx#35411)
* Simplify ConnectHelper.ConnectAsync to just return Stream
SocketsHttpHandler's ConnectHelper.ConnectAsync currently returns a tuple of (Socket, Stream). We can instead just have it return the Stream and allow the call site to fish out the Socket from the Stream if it can. This is slightly more efficient memory-wise, in that the state machine involved will be smaller, but it also allows for a potential extensibility point that's simpler (abstracting out the ConnectAsync as a callback) and potentially allows us to in the future get a Socket in more cases, e.g. any connection helper handing back a NetworkStream.
Unfortunately, NetworkStream.Socket is protected rather than public. Until such time that there's a public property for this, there are two options here:
1. Use reflection to create a delegate we can then use to get at the property; "Socket" is part of the exposed surface area, so the only dependency here is on documented surface area.
2. Create a custom NetworkStream-derived type that exposes the protected as a public.
I started with (2), which works fine for our own internal needs currently, but shifted to (1), as it's more flexible.
* Don't use reflection
Commit migrated from https://github.com/dotnet/corefx/commit/
d9cdbc3cca0f75e5d7692f9ae03978dd0ed9b2e9