fixes for ManagedWebSocket server mode Commit migrated from https://github.com/dotnet/corefx/commit/745c2f6fbc9b5bd0ae12b9f109456c2ad64d1c87