Revert "Use protocol.abstractions primitives instead of socket abstractions (#1429)" (#1431)

This reverts commit e3f197cef0.
This commit is contained in:
David Fowler 2018-02-10 11:30:41 -08:00 committed by GitHub
parent e3f197cef0
commit 3e568588d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 163 additions and 149 deletions

View File

@ -7,52 +7,51 @@
<BuildBundlerMinifierPackageVersion>2.4.337</BuildBundlerMinifierPackageVersion>
<GoogleProtobufPackageVersion>3.1.0</GoogleProtobufPackageVersion>
<InternalAspNetCoreSdkPackageVersion>2.1.0-preview2-15698</InternalAspNetCoreSdkPackageVersion>
<MicrosoftAspNetCoreAuthenticationCookiesPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreAuthenticationCookiesPackageVersion>
<MicrosoftAspNetCoreAuthenticationCorePackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreAuthenticationCorePackageVersion>
<MicrosoftAspNetCoreAuthenticationJwtBearerPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreAuthenticationJwtBearerPackageVersion>
<MicrosoftAspNetCoreAuthorizationPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreAuthorizationPackageVersion>
<MicrosoftAspNetCoreAuthorizationPolicyPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreAuthorizationPolicyPackageVersion>
<MicrosoftAspNetCoreBenchmarkRunnerSourcesPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreBenchmarkRunnerSourcesPackageVersion>
<MicrosoftAspNetCoreCorsPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreCorsPackageVersion>
<MicrosoftAspNetCoreDiagnosticsEntityFrameworkCorePackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreDiagnosticsEntityFrameworkCorePackageVersion>
<MicrosoftAspNetCoreDiagnosticsPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreDiagnosticsPackageVersion>
<MicrosoftAspNetCoreHostingAbstractionsPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreHostingAbstractionsPackageVersion>
<MicrosoftAspNetCoreHostingPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreHostingPackageVersion>
<MicrosoftAspNetCoreHttpAbstractionsPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreHttpAbstractionsPackageVersion>
<MicrosoftAspNetCoreHttpFeaturesPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreHttpFeaturesPackageVersion>
<MicrosoftAspNetCoreHttpPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreHttpPackageVersion>
<MicrosoftAspNetCoreIdentityEntityFrameworkCorePackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreIdentityEntityFrameworkCorePackageVersion>
<MicrosoftAspNetCoreMvcPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreMvcPackageVersion>
<MicrosoftAspNetCoreProtocolsAbstractionsPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreProtocolsAbstractionsPackageVersion>
<MicrosoftAspNetCoreRoutingPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreRoutingPackageVersion>
<MicrosoftAspNetCoreServerIISIntegrationPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreServerIISIntegrationPackageVersion>
<MicrosoftAspNetCoreServerIntegrationTestingPackageVersion>0.5.0-preview2-30070</MicrosoftAspNetCoreServerIntegrationTestingPackageVersion>
<MicrosoftAspNetCoreServerKestrelPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreServerKestrelPackageVersion>
<MicrosoftAspNetCoreStaticFilesPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreStaticFilesPackageVersion>
<MicrosoftAspNetCoreTestHostPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreTestHostPackageVersion>
<MicrosoftAspNetCoreTestingPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreTestingPackageVersion>
<MicrosoftAspNetCoreWebSocketsPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreWebSocketsPackageVersion>
<MicrosoftAspNetCoreAuthenticationCookiesPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreAuthenticationCookiesPackageVersion>
<MicrosoftAspNetCoreAuthenticationCorePackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreAuthenticationCorePackageVersion>
<MicrosoftAspNetCoreAuthenticationJwtBearerPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreAuthenticationJwtBearerPackageVersion>
<MicrosoftAspNetCoreAuthorizationPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreAuthorizationPackageVersion>
<MicrosoftAspNetCoreAuthorizationPolicyPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreAuthorizationPolicyPackageVersion>
<MicrosoftAspNetCoreBenchmarkRunnerSourcesPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreBenchmarkRunnerSourcesPackageVersion>
<MicrosoftAspNetCoreCorsPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreCorsPackageVersion>
<MicrosoftAspNetCoreDiagnosticsEntityFrameworkCorePackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreDiagnosticsEntityFrameworkCorePackageVersion>
<MicrosoftAspNetCoreDiagnosticsPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreDiagnosticsPackageVersion>
<MicrosoftAspNetCoreHostingAbstractionsPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreHostingAbstractionsPackageVersion>
<MicrosoftAspNetCoreHostingPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreHostingPackageVersion>
<MicrosoftAspNetCoreHttpAbstractionsPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreHttpAbstractionsPackageVersion>
<MicrosoftAspNetCoreHttpFeaturesPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreHttpFeaturesPackageVersion>
<MicrosoftAspNetCoreHttpPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreHttpPackageVersion>
<MicrosoftAspNetCoreIdentityEntityFrameworkCorePackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreIdentityEntityFrameworkCorePackageVersion>
<MicrosoftAspNetCoreMvcPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreMvcPackageVersion>
<MicrosoftAspNetCoreRoutingPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreRoutingPackageVersion>
<MicrosoftAspNetCoreServerIISIntegrationPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreServerIISIntegrationPackageVersion>
<MicrosoftAspNetCoreServerIntegrationTestingPackageVersion>0.5.0-preview2-30066</MicrosoftAspNetCoreServerIntegrationTestingPackageVersion>
<MicrosoftAspNetCoreServerKestrelPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreServerKestrelPackageVersion>
<MicrosoftAspNetCoreStaticFilesPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreStaticFilesPackageVersion>
<MicrosoftAspNetCoreTestHostPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreTestHostPackageVersion>
<MicrosoftAspNetCoreTestingPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreTestingPackageVersion>
<MicrosoftAspNetCoreWebSocketsPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreWebSocketsPackageVersion>
<MicrosoftCSharpPackageVersion>4.5.0-preview2-26130-01</MicrosoftCSharpPackageVersion>
<MicrosoftEntityFrameworkCoreDesignPackageVersion>2.1.0-preview2-30070</MicrosoftEntityFrameworkCoreDesignPackageVersion>
<MicrosoftEntityFrameworkCoreSqlServerPackageVersion>2.1.0-preview2-30070</MicrosoftEntityFrameworkCoreSqlServerPackageVersion>
<MicrosoftEntityFrameworkCoreToolsPackageVersion>2.1.0-preview2-30070</MicrosoftEntityFrameworkCoreToolsPackageVersion>
<MicrosoftExtensionsClosedGenericMatcherSourcesPackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsClosedGenericMatcherSourcesPackageVersion>
<MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion>
<MicrosoftExtensionsConfigurationCommandLinePackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsConfigurationCommandLinePackageVersion>
<MicrosoftExtensionsConfigurationEnvironmentVariablesPackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsConfigurationEnvironmentVariablesPackageVersion>
<MicrosoftExtensionsConfigurationUserSecretsPackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsConfigurationUserSecretsPackageVersion>
<MicrosoftExtensionsDependencyInjectionAbstractionsPackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsDependencyInjectionAbstractionsPackageVersion>
<MicrosoftExtensionsDependencyInjectionPackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsDependencyInjectionPackageVersion>
<MicrosoftExtensionsLoggingAbstractionsPackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsLoggingAbstractionsPackageVersion>
<MicrosoftExtensionsLoggingConfigurationPackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsLoggingConfigurationPackageVersion>
<MicrosoftExtensionsLoggingConsolePackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsLoggingConsolePackageVersion>
<MicrosoftExtensionsLoggingDebugPackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsLoggingDebugPackageVersion>
<MicrosoftExtensionsLoggingPackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsLoggingPackageVersion>
<MicrosoftExtensionsLoggingTestingPackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsLoggingTestingPackageVersion>
<MicrosoftExtensionsObjectMethodExecutorSourcesPackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsObjectMethodExecutorSourcesPackageVersion>
<MicrosoftExtensionsOptionsPackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsOptionsPackageVersion>
<MicrosoftExtensionsSecurityHelperSourcesPackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsSecurityHelperSourcesPackageVersion>
<MicrosoftExtensionsValueStopwatchSourcesPackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsValueStopwatchSourcesPackageVersion>
<MicrosoftEntityFrameworkCoreDesignPackageVersion>2.1.0-preview2-30066</MicrosoftEntityFrameworkCoreDesignPackageVersion>
<MicrosoftEntityFrameworkCoreSqlServerPackageVersion>2.1.0-preview2-30066</MicrosoftEntityFrameworkCoreSqlServerPackageVersion>
<MicrosoftEntityFrameworkCoreToolsPackageVersion>2.1.0-preview2-30066</MicrosoftEntityFrameworkCoreToolsPackageVersion>
<MicrosoftExtensionsClosedGenericMatcherSourcesPackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsClosedGenericMatcherSourcesPackageVersion>
<MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion>
<MicrosoftExtensionsConfigurationCommandLinePackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsConfigurationCommandLinePackageVersion>
<MicrosoftExtensionsConfigurationEnvironmentVariablesPackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsConfigurationEnvironmentVariablesPackageVersion>
<MicrosoftExtensionsConfigurationUserSecretsPackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsConfigurationUserSecretsPackageVersion>
<MicrosoftExtensionsDependencyInjectionAbstractionsPackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsDependencyInjectionAbstractionsPackageVersion>
<MicrosoftExtensionsDependencyInjectionPackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsDependencyInjectionPackageVersion>
<MicrosoftExtensionsLoggingAbstractionsPackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsLoggingAbstractionsPackageVersion>
<MicrosoftExtensionsLoggingConfigurationPackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsLoggingConfigurationPackageVersion>
<MicrosoftExtensionsLoggingConsolePackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsLoggingConsolePackageVersion>
<MicrosoftExtensionsLoggingDebugPackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsLoggingDebugPackageVersion>
<MicrosoftExtensionsLoggingPackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsLoggingPackageVersion>
<MicrosoftExtensionsLoggingTestingPackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsLoggingTestingPackageVersion>
<MicrosoftExtensionsObjectMethodExecutorSourcesPackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsObjectMethodExecutorSourcesPackageVersion>
<MicrosoftExtensionsOptionsPackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsOptionsPackageVersion>
<MicrosoftExtensionsSecurityHelperSourcesPackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsSecurityHelperSourcesPackageVersion>
<MicrosoftExtensionsValueStopwatchSourcesPackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsValueStopwatchSourcesPackageVersion>
<MicrosoftNETCoreApp20PackageVersion>2.0.0</MicrosoftNETCoreApp20PackageVersion>
<MicrosoftNETCoreApp21PackageVersion>2.1.0-preview2-26130-04</MicrosoftNETCoreApp21PackageVersion>
<MicrosoftNETTestSdkPackageVersion>15.3.0</MicrosoftNETTestSdkPackageVersion>
@ -71,7 +70,7 @@
<SystemThreadingChannelsPackageVersion>4.5.0-preview2-26130-01</SystemThreadingChannelsPackageVersion>
<SystemThreadingTasksExtensionsPackageVersion>4.5.0-preview2-26130-01</SystemThreadingTasksExtensionsPackageVersion>
<XunitPackageVersion>2.3.1</XunitPackageVersion>
<XunitRunnerVisualStudioPackageVersion>2.4.0-beta.1.build3945</XunitRunnerVisualStudioPackageVersion>
<XunitRunnerVisualStudioPackageVersion>2.3.1</XunitRunnerVisualStudioPackageVersion>
</PropertyGroup>
<Import Project="$(DotNetPackageVersionPropsPath)" Condition=" '$(DotNetPackageVersionPropsPath)' != '' " />
</Project>

View File

@ -3,7 +3,6 @@
using System.IO.Pipelines;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Protocols;
using Microsoft.AspNetCore.Sockets;
namespace FunctionalTests

View File

@ -6,7 +6,6 @@ using System.Collections.Generic;
using System.IO;
using System.IO.Pipelines;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Protocols;
using Microsoft.AspNetCore.Sockets;
using Microsoft.AspNetCore.Sockets.Features;
@ -24,9 +23,9 @@ namespace SocialWeather
public void OnConnectedAsync(ConnectionContext connection)
{
connection.Features.Get<IConnectionMetadataFeature>().Metadata["groups"] = new HashSet<string>();
connection.Metadata["groups"] = new HashSet<string>();
var format = connection.GetHttpContext().Request.Query["formatType"].ToString();
connection.Features.Get<IConnectionMetadataFeature>().Metadata["format"] = format;
connection.Metadata["format"] = format;
if (string.Equals(format, "protobuf", StringComparison.OrdinalIgnoreCase))
{
var transferModeFeature = connection.Features.Get<ITransferModeFeature>();
@ -48,7 +47,7 @@ namespace SocialWeather
foreach (var connection in _connectionList)
{
var context = connection.GetHttpContext();
var formatter = _formatterResolver.GetFormatter<T>((string)connection.Features.Get<IConnectionMetadataFeature>().Metadata["format"]);
var formatter = _formatterResolver.GetFormatter<T>((string)connection.Metadata["format"]);
var ms = new MemoryStream();
await formatter.WriteAsync(data, ms);
@ -73,7 +72,7 @@ namespace SocialWeather
public void AddGroupAsync(ConnectionContext connection, string groupName)
{
var groups = (HashSet<string>)connection.Features.Get<IConnectionMetadataFeature>().Metadata["groups"];
var groups = (HashSet<string>)connection.Metadata["groups"];
lock (groups)
{
groups.Add(groupName);
@ -82,7 +81,7 @@ namespace SocialWeather
public void RemoveGroupAsync(ConnectionContext connection, string groupName)
{
var groups = (HashSet<string>)connection.Features.Get<IConnectionMetadataFeature>().Metadata["groups"];
var groups = (HashSet<string>)connection.Metadata["groups"];
if (groups != null)
{
lock (groups)

View File

@ -3,9 +3,7 @@
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Protocols;
using Microsoft.AspNetCore.Sockets;
using Microsoft.AspNetCore.Sockets.Features;
using Microsoft.Extensions.Logging;
namespace SocialWeather
@ -34,7 +32,7 @@ namespace SocialWeather
public async Task ProcessRequests(ConnectionContext connection)
{
var formatter = _formatterResolver.GetFormatter<WeatherReport>(
(string)connection.Features.Get<IConnectionMetadataFeature>().Metadata["format"]);
(string)connection.Metadata["format"]);
while (true)
{

View File

@ -5,9 +5,7 @@ using System.Collections.Generic;
using System.IO.Pipelines;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Protocols;
using Microsoft.AspNetCore.Sockets;
using Microsoft.AspNetCore.Sockets.Features;
namespace SocketsSample.EndPoints
{
@ -19,7 +17,7 @@ namespace SocketsSample.EndPoints
{
Connections.Add(connection);
await Broadcast($"{connection.ConnectionId} connected ({connection.Features.Get<IConnectionMetadataFeature>().Metadata[ConnectionMetadataNames.Transport]})");
await Broadcast($"{connection.ConnectionId} connected ({connection.Metadata[ConnectionMetadataNames.Transport]})");
try
{
@ -52,7 +50,7 @@ namespace SocketsSample.EndPoints
{
Connections.Remove(connection);
await Broadcast($"{connection.ConnectionId} disconnected ({connection.Features.Get<IConnectionMetadataFeature>().Metadata[ConnectionMetadataNames.Transport]})");
await Broadcast($"{connection.ConnectionId} disconnected ({connection.Metadata[ConnectionMetadataNames.Transport]})");
}
}

View File

@ -3,10 +3,8 @@
using System.IO;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.SignalR;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using SocketsSample.Hubs;
namespace SocketsSample
{
@ -25,18 +23,7 @@ namespace SocketsSample
{
factory.AddConsole();
})
.UseKestrel(options =>
{
// Default port
options.ListenLocalhost(5000);
// Hub bound to TCP end point
options.ListenLocalhost(9001, builder =>
{
// Run the hub on this port (this won't work properly until streaming parsing is implemented)
builder.UseHub<Chat>();
});
})
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()

View File

@ -13,7 +13,6 @@ using System.Threading;
using System.Threading.Channels;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Protocols;
using Microsoft.AspNetCore.SignalR.Core;
using Microsoft.AspNetCore.SignalR.Internal;
using Microsoft.AspNetCore.SignalR.Internal.Encoders;
@ -65,7 +64,7 @@ namespace Microsoft.AspNetCore.SignalR
public virtual IFeatureCollection Features => _connectionContext.Features;
public virtual IDictionary<object, object> Metadata => Features.Get<IConnectionMetadataFeature>().Metadata;
public virtual IDictionary<object, object> Metadata => _connectionContext.Metadata;
public virtual PipeReader Input => _connectionContext.Transport.Input;

View File

@ -11,10 +11,10 @@ using System.Threading;
using System.Threading.Channels;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Protocols;
using Microsoft.AspNetCore.SignalR.Core;
using Microsoft.AspNetCore.SignalR.Internal;
using Microsoft.AspNetCore.SignalR.Internal.Protocol;
using Microsoft.AspNetCore.Sockets;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Internal;
using Microsoft.Extensions.Logging;

View File

@ -1,7 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNetCore.Protocols;
using Microsoft.AspNetCore.Sockets;
using Microsoft.Extensions.DependencyInjection;
@ -9,7 +8,7 @@ namespace Microsoft.AspNetCore.SignalR
{
public static class SignalRSocketBuilderExtensions
{
public static IConnectionBuilder UseHub<THub>(this IConnectionBuilder socketBuilder) where THub : Hub
public static ISocketBuilder UseHub<THub>(this ISocketBuilder socketBuilder) where THub : Hub
{
var endpoint = socketBuilder.ApplicationServices.GetRequiredService<HubEndPoint<THub>>();
return socketBuilder.Run(connection => endpoint.OnConnectedAsync(connection));

View File

@ -0,0 +1,20 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
using System.IO.Pipelines;
using Microsoft.AspNetCore.Http.Features;
namespace Microsoft.AspNetCore.Sockets
{
public abstract class ConnectionContext
{
public abstract string ConnectionId { get; set; }
public abstract IFeatureCollection Features { get; }
public abstract IDictionary<object, object> Metadata { get; set; }
public abstract IDuplexPipe Transport { get; set; }
}
}

View File

@ -0,0 +1,18 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Text;
namespace Microsoft.AspNetCore.Sockets
{
public interface ISocketBuilder
{
IServiceProvider ApplicationServices { get; }
ISocketBuilder Use(Func<SocketDelegate, SocketDelegate> middleware);
SocketDelegate Build();
}
}

View File

@ -8,7 +8,6 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Http.Features" Version="$(MicrosoftAspNetCoreHttpFeaturesPackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Protocols.Abstractions" Version="$(MicrosoftAspNetCoreProtocolsAbstractionsPackageVersion)" />
<PackageReference Include="System.Threading.Channels" Version="$(SystemThreadingChannelsPackageVersion)" />
<PackageReference Include="System.IO.Pipelines" Version="$(SystemIOPipelinesPackageVersion)" />
<PackageReference Include="System.Memory" Version="$(SystemMemoryPackageVersion)" />

View File

@ -6,30 +6,29 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Protocols;
namespace Microsoft.AspNetCore.Sockets
{
public class ConnectionBuilder : IConnectionBuilder
public class SocketBuilder : ISocketBuilder
{
private readonly IList<Func<ConnectionDelegate, ConnectionDelegate>> _components = new List<Func<ConnectionDelegate, ConnectionDelegate>>();
private readonly IList<Func<SocketDelegate, SocketDelegate>> _components = new List<Func<SocketDelegate, SocketDelegate>>();
public IServiceProvider ApplicationServices { get; }
public ConnectionBuilder(IServiceProvider applicationServices)
public SocketBuilder(IServiceProvider applicationServices)
{
ApplicationServices = applicationServices;
}
public IConnectionBuilder Use(Func<ConnectionDelegate, ConnectionDelegate> middleware)
public ISocketBuilder Use(Func<SocketDelegate, SocketDelegate> middleware)
{
_components.Add(middleware);
return this;
}
public ConnectionDelegate Build()
public SocketDelegate Build()
{
ConnectionDelegate app = features =>
SocketDelegate app = features =>
{
return Task.CompletedTask;
};

View File

@ -3,13 +3,12 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Protocols;
namespace Microsoft.AspNetCore.Sockets
{
public static class SocketBuilderExtensions
{
public static IConnectionBuilder Use(this IConnectionBuilder socketBuilder, Func<ConnectionContext, Func<Task>, Task> middleware)
public static ISocketBuilder Use(this ISocketBuilder socketBuilder, Func<ConnectionContext, Func<Task>, Task> middleware)
{
return socketBuilder.Use(next =>
{
@ -21,7 +20,7 @@ namespace Microsoft.AspNetCore.Sockets
});
}
public static IConnectionBuilder Run(this IConnectionBuilder socketBuilder, Func<ConnectionContext, Task> middleware)
public static ISocketBuilder Run(this ISocketBuilder socketBuilder, Func<ConnectionContext, Task> middleware)
{
return socketBuilder.Use(next =>
{

View File

@ -0,0 +1,12 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace Microsoft.AspNetCore.Sockets
{
public delegate Task SocketDelegate(ConnectionContext connection);
}

View File

@ -1,8 +1,10 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Protocols;
using Microsoft.AspNetCore.Sockets.Http.Features;
namespace Microsoft.AspNetCore.Sockets

View File

@ -10,7 +10,6 @@ using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Protocols;
using Microsoft.AspNetCore.Sockets.Features;
using Microsoft.AspNetCore.Sockets.Internal;
using Microsoft.AspNetCore.Sockets.Internal.Transports;
@ -33,7 +32,7 @@ namespace Microsoft.AspNetCore.Sockets
_logger = _loggerFactory.CreateLogger<HttpConnectionDispatcher>();
}
public async Task ExecuteAsync(HttpContext context, HttpSocketOptions options, ConnectionDelegate ConnectionDelegate)
public async Task ExecuteAsync(HttpContext context, HttpSocketOptions options, SocketDelegate socketDelegate)
{
// Create the log scope and attempt to pass the Connection ID to it so as many logs as possible contain
// the Connection ID metadata. If this is the negotiate request then the Connection ID for the scope will
@ -54,7 +53,7 @@ namespace Microsoft.AspNetCore.Sockets
else if (HttpMethods.IsGet(context.Request.Method))
{
// GET /{path}
await ExecuteEndpointAsync(context, ConnectionDelegate, options, logScope);
await ExecuteEndpointAsync(context, socketDelegate, options, logScope);
}
else
{
@ -88,7 +87,7 @@ namespace Microsoft.AspNetCore.Sockets
}
}
private async Task ExecuteEndpointAsync(HttpContext context, ConnectionDelegate ConnectionDelegate, HttpSocketOptions options, ConnectionLogScope logScope)
private async Task ExecuteEndpointAsync(HttpContext context, SocketDelegate socketDelegate, HttpSocketOptions options, ConnectionLogScope logScope)
{
var supportedTransports = options.Transports;
@ -120,7 +119,7 @@ namespace Microsoft.AspNetCore.Sockets
// We only need to provide the Input channel since writing to the application is handled through /send.
var sse = new ServerSentEventsTransport(connection.Application.Input, connection.ConnectionId, _loggerFactory);
await DoPersistentConnection(ConnectionDelegate, sse, context, connection);
await DoPersistentConnection(socketDelegate, sse, context, connection);
}
else if (context.WebSockets.IsWebSocketRequest)
{
@ -142,7 +141,7 @@ namespace Microsoft.AspNetCore.Sockets
var ws = new WebSocketsTransport(options.WebSockets, connection.Application, connection, _loggerFactory);
await DoPersistentConnection(ConnectionDelegate, ws, context, connection);
await DoPersistentConnection(socketDelegate, ws, context, connection);
}
else
{
@ -203,7 +202,7 @@ namespace Microsoft.AspNetCore.Sockets
connection.Metadata[ConnectionMetadataNames.Transport] = TransportType.LongPolling;
connection.ApplicationTask = ExecuteApplication(ConnectionDelegate, connection);
connection.ApplicationTask = ExecuteApplication(socketDelegate, connection);
}
else
{
@ -292,7 +291,7 @@ namespace Microsoft.AspNetCore.Sockets
}
}
private async Task DoPersistentConnection(ConnectionDelegate ConnectionDelegate,
private async Task DoPersistentConnection(SocketDelegate socketDelegate,
IHttpTransport transport,
HttpContext context,
DefaultConnectionContext connection)
@ -324,7 +323,7 @@ namespace Microsoft.AspNetCore.Sockets
connection.Status = DefaultConnectionContext.ConnectionStatus.Active;
// Call into the end point passing the connection
connection.ApplicationTask = ExecuteApplication(ConnectionDelegate, connection);
connection.ApplicationTask = ExecuteApplication(socketDelegate, connection);
// Start the transport
connection.TransportTask = transport.ProcessRequestAsync(context, context.RequestAborted);
@ -340,12 +339,12 @@ namespace Microsoft.AspNetCore.Sockets
await _manager.DisposeAndRemoveAsync(connection);
}
private async Task ExecuteApplication(ConnectionDelegate ConnectionDelegate, ConnectionContext connection)
private async Task ExecuteApplication(SocketDelegate socketDelegate, ConnectionContext connection)
{
// Verify some initialization invariants
// We want to be positive that the IConnectionInherentKeepAliveFeature is initialized before invoking the application, if the long polling transport is in use.
Debug.Assert(connection.Features.Get<IConnectionMetadataFeature>().Metadata[ConnectionMetadataNames.Transport] != null, "Transport has not been initialized yet");
Debug.Assert((TransportType?)connection.Features.Get<IConnectionMetadataFeature>().Metadata[ConnectionMetadataNames.Transport] != TransportType.LongPolling ||
Debug.Assert(connection.Metadata[ConnectionMetadataNames.Transport] != null, "Transport has not been initialized yet");
Debug.Assert((TransportType?)connection.Metadata[ConnectionMetadataNames.Transport] != TransportType.LongPolling ||
connection.Features.Get<IConnectionInherentKeepAliveFeature>() != null, "Long-polling transport is in use but IConnectionInherentKeepAliveFeature as not configured");
// Jump onto the thread pool thread so blocking user code doesn't block the setup of the
@ -353,7 +352,7 @@ namespace Microsoft.AspNetCore.Sockets
await AwaitableThreadPool.Yield();
// Running this in an async method turns sync exceptions into async ones
await ConnectionDelegate(connection);
await socketDelegate(connection);
}
private Task ProcessNegotiate(HttpContext context, HttpSocketOptions options, ConnectionLogScope logScope)

View File

@ -5,7 +5,6 @@ using System;
using System.Reflection;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Protocols;
using Microsoft.AspNetCore.Routing;
namespace Microsoft.AspNetCore.Sockets
@ -21,15 +20,15 @@ namespace Microsoft.AspNetCore.Sockets
_dispatcher = dispatcher;
}
public void MapSocket(string path, Action<IConnectionBuilder> socketConfig) =>
public void MapSocket(string path, Action<ISocketBuilder> socketConfig) =>
MapSocket(new PathString(path), new HttpSocketOptions(), socketConfig);
public void MapSocket(PathString path, Action<IConnectionBuilder> socketConfig) =>
public void MapSocket(PathString path, Action<ISocketBuilder> socketConfig) =>
MapSocket(path, new HttpSocketOptions(), socketConfig);
public void MapSocket(PathString path, HttpSocketOptions options, Action<IConnectionBuilder> socketConfig)
public void MapSocket(PathString path, HttpSocketOptions options, Action<ISocketBuilder> socketConfig)
{
var socketBuilder = new ConnectionBuilder(_routes.ServiceProvider);
var socketBuilder = new SocketBuilder(_routes.ServiceProvider);
socketConfig(socketBuilder);
var socket = socketBuilder.Build();
_routes.MapRoute(path, c => _dispatcher.ExecuteAsync(c, options, socket));

View File

@ -5,7 +5,6 @@ using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using Microsoft.AspNetCore.Protocols;
namespace Microsoft.AspNetCore.Sockets
{

View File

@ -2,14 +2,12 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Buffers;
using System.Collections.Generic;
using System.IO.Pipelines;
using System.Security.Claims;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Protocols;
using Microsoft.AspNetCore.Sockets.Features;
using Microsoft.Extensions.Internal;
@ -65,7 +63,7 @@ namespace Microsoft.AspNetCore.Sockets
public ClaimsPrincipal User { get; set; }
public IDictionary<object, object> Metadata { get; set; } = new ConnectionMetadata();
public override IDictionary<object, object> Metadata { get; set; } = new ConnectionMetadata();
public IDuplexPipe Application { get; }
@ -75,8 +73,6 @@ namespace Microsoft.AspNetCore.Sockets
public TransferMode TransferMode { get; set; }
public override MemoryPool MemoryPool { get; }
public void OnHeartbeat(Action<object> action, object state)
{
lock (_heartbeatHandlers)

View File

@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Threading.Tasks;
using Microsoft.AspNetCore.Protocols;
namespace Microsoft.AspNetCore.Sockets
{

View File

@ -1,14 +1,13 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNetCore.Protocols;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Sockets
{
public static class SocketBuilderExtensions
{
public static IConnectionBuilder UseEndPoint<TEndPoint>(this IConnectionBuilder socketBuilder) where TEndPoint : EndPoint
public static ISocketBuilder UseEndPoint<TEndPoint>(this ISocketBuilder socketBuilder) where TEndPoint : EndPoint
{
var endpoint = socketBuilder.ApplicationServices.GetRequiredService<TEndPoint>();
// This is a terminal middleware, so there's no need to use the 'next' parameter

View File

@ -3,7 +3,6 @@
using System.IO.Pipelines;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Protocols;
using Microsoft.AspNetCore.Sockets;
namespace Microsoft.AspNetCore.SignalR.Tests

View File

@ -3,7 +3,6 @@
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Protocols;
using Microsoft.AspNetCore.SignalR.Internal;
using Microsoft.AspNetCore.SignalR.Internal.Protocol;
using Microsoft.AspNetCore.Sockets;

View File

@ -15,7 +15,6 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Http.Internal;
using Microsoft.AspNetCore.Protocols;
using Microsoft.AspNetCore.Sockets.Features;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -117,7 +116,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
context.Request.Query = qs;
SetTransport(context, transportType);
var builder = new ConnectionBuilder(services.BuildServiceProvider());
var builder = new SocketBuilder(services.BuildServiceProvider());
builder.UseEndPoint<TestEndPoint>();
var app = builder.Build();
await dispatcher.ExecuteAsync(context, new HttpSocketOptions(), app);
@ -152,7 +151,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
var qs = new QueryCollection(values);
context.Request.Query = qs;
var builder = new ConnectionBuilder(services.BuildServiceProvider());
var builder = new SocketBuilder(services.BuildServiceProvider());
builder.UseEndPoint<TestEndPoint>();
var app = builder.Build();
await dispatcher.ExecuteAsync(context, new HttpSocketOptions(), app);
@ -189,7 +188,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
var qs = new QueryCollection(values);
context.Request.Query = qs;
var builder = new ConnectionBuilder(services.BuildServiceProvider());
var builder = new SocketBuilder(services.BuildServiceProvider());
builder.UseEndPoint<TestEndPoint>();
var app = builder.Build();
await dispatcher.ExecuteAsync(context, new HttpSocketOptions(), app);
@ -234,7 +233,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
var qs = new QueryCollection(values);
context.Request.Query = qs;
var builder = new ConnectionBuilder(services.BuildServiceProvider());
var builder = new SocketBuilder(services.BuildServiceProvider());
builder.UseEndPoint<TestEndPoint>();
var app = builder.Build();
@ -269,7 +268,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
SetTransport(context, transportType);
var builder = new ConnectionBuilder(services.BuildServiceProvider());
var builder = new SocketBuilder(services.BuildServiceProvider());
builder.UseEndPoint<TestEndPoint>();
var app = builder.Build();
await dispatcher.ExecuteAsync(context, new HttpSocketOptions(), app);
@ -298,7 +297,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
context.Request.Path = "/foo";
context.Request.Method = "POST";
var builder = new ConnectionBuilder(services.BuildServiceProvider());
var builder = new SocketBuilder(services.BuildServiceProvider());
builder.UseEndPoint<TestEndPoint>();
var app = builder.Build();
await dispatcher.ExecuteAsync(context, new HttpSocketOptions(), app);
@ -371,7 +370,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
var services = new ServiceCollection();
services.AddEndPoint<ImmediatelyCompleteEndPoint>();
var builder = new ConnectionBuilder(services.BuildServiceProvider());
var builder = new SocketBuilder(services.BuildServiceProvider());
builder.UseEndPoint<ImmediatelyCompleteEndPoint>();
var app = builder.Build();
await dispatcher.ExecuteAsync(context, new HttpSocketOptions(), app);
@ -397,7 +396,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
var services = new ServiceCollection();
services.AddEndPoint<SynchronusExceptionEndPoint>();
var builder = new ConnectionBuilder(services.BuildServiceProvider());
var builder = new SocketBuilder(services.BuildServiceProvider());
builder.UseEndPoint<SynchronusExceptionEndPoint>();
var app = builder.Build();
await dispatcher.ExecuteAsync(context, new HttpSocketOptions(), app);
@ -423,7 +422,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
var services = new ServiceCollection();
services.AddEndPoint<ImmediatelyCompleteEndPoint>();
var builder = new ConnectionBuilder(services.BuildServiceProvider());
var builder = new SocketBuilder(services.BuildServiceProvider());
builder.UseEndPoint<ImmediatelyCompleteEndPoint>();
var app = builder.Build();
await dispatcher.ExecuteAsync(context, new HttpSocketOptions(), app);
@ -449,7 +448,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
var services = new ServiceCollection();
services.AddEndPoint<TestEndPoint>();
var builder = new ConnectionBuilder(services.BuildServiceProvider());
var builder = new SocketBuilder(services.BuildServiceProvider());
builder.UseEndPoint<TestEndPoint>();
var app = builder.Build();
var options = new HttpSocketOptions();
@ -475,7 +474,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
var services = new ServiceCollection();
services.AddEndPoint<ImmediatelyCompleteEndPoint>();
var builder = new ConnectionBuilder(services.BuildServiceProvider());
var builder = new SocketBuilder(services.BuildServiceProvider());
builder.UseEndPoint<ImmediatelyCompleteEndPoint>();
var app = builder.Build();
var options = new HttpSocketOptions();
@ -507,7 +506,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
var services = new ServiceCollection();
services.AddEndPoint<TestEndPoint>();
var builder = new ConnectionBuilder(services.BuildServiceProvider());
var builder = new SocketBuilder(services.BuildServiceProvider());
builder.UseEndPoint<TestEndPoint>();
var app = builder.Build();
var options = new HttpSocketOptions();
@ -546,7 +545,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
var services = new ServiceCollection();
services.AddEndPoint<TestEndPoint>();
var builder = new ConnectionBuilder(services.BuildServiceProvider());
var builder = new SocketBuilder(services.BuildServiceProvider());
builder.UseEndPoint<TestEndPoint>();
var app = builder.Build();
var options = new HttpSocketOptions();
@ -584,7 +583,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
var services = new ServiceCollection();
services.AddEndPoint<TestEndPoint>();
var builder = new ConnectionBuilder(services.BuildServiceProvider());
var builder = new SocketBuilder(services.BuildServiceProvider());
builder.UseEndPoint<TestEndPoint>();
var app = builder.Build();
var options = new HttpSocketOptions();
@ -609,7 +608,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
var services = new ServiceCollection();
services.AddEndPoint<TestEndPoint>();
var builder = new ConnectionBuilder(services.BuildServiceProvider());
var builder = new SocketBuilder(services.BuildServiceProvider());
builder.UseEndPoint<TestEndPoint>();
var app = builder.Build();
var options = new HttpSocketOptions();
@ -644,7 +643,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
var services = new ServiceCollection();
services.AddEndPoint<BlockingEndPoint>();
var builder = new ConnectionBuilder(services.BuildServiceProvider());
var builder = new SocketBuilder(services.BuildServiceProvider());
builder.UseEndPoint<BlockingEndPoint>();
var app = builder.Build();
var options = new HttpSocketOptions();
@ -677,7 +676,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
var services = new ServiceCollection();
services.AddEndPoint<BlockingEndPoint>();
var builder = new ConnectionBuilder(services.BuildServiceProvider());
var builder = new SocketBuilder(services.BuildServiceProvider());
builder.UseEndPoint<BlockingEndPoint>();
var app = builder.Build();
var options = new HttpSocketOptions();
@ -708,7 +707,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
var services = new ServiceCollection();
services.AddEndPoint<TestEndPoint>();
var builder = new ConnectionBuilder(services.BuildServiceProvider());
var builder = new SocketBuilder(services.BuildServiceProvider());
builder.UseEndPoint<TestEndPoint>();
var app = builder.Build();
var options = new HttpSocketOptions();
@ -752,7 +751,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
var services = new ServiceCollection();
services.AddEndPoint<ImmediatelyCompleteEndPoint>();
var builder = new ConnectionBuilder(services.BuildServiceProvider());
var builder = new SocketBuilder(services.BuildServiceProvider());
builder.UseEndPoint<ImmediatelyCompleteEndPoint>();
var app = builder.Build();
@ -796,7 +795,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
var qs = new QueryCollection(values);
context.Request.Query = qs;
var builder = new ConnectionBuilder(sp);
var builder = new SocketBuilder(sp);
builder.UseEndPoint<TestEndPoint>();
var app = builder.Build();
var options = new HttpSocketOptions();
@ -841,7 +840,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
var qs = new QueryCollection(values);
context.Request.Query = qs;
var builder = new ConnectionBuilder(sp);
var builder = new SocketBuilder(sp);
builder.UseEndPoint<TestEndPoint>();
var app = builder.Build();
var options = new HttpSocketOptions();
@ -893,7 +892,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
context.Request.Query = qs;
context.Response.Body = new MemoryStream();
var builder = new ConnectionBuilder(sp);
var builder = new SocketBuilder(sp);
builder.UseEndPoint<TestEndPoint>();
var app = builder.Build();
var options = new HttpSocketOptions();
@ -953,7 +952,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
context.Request.Query = qs;
context.Response.Body = new MemoryStream();
var builder = new ConnectionBuilder(sp);
var builder = new SocketBuilder(sp);
builder.UseEndPoint<TestEndPoint>();
var app = builder.Build();
var options = new HttpSocketOptions();
@ -1031,7 +1030,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
context.Request.Query = qs;
context.Response.Body = new MemoryStream();
var builder = new ConnectionBuilder(sp);
var builder = new SocketBuilder(sp);
builder.UseEndPoint<TestEndPoint>();
var app = builder.Build();
var options = new HttpSocketOptions();
@ -1087,7 +1086,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
context.Request.Query = qs;
context.Response.Body = new MemoryStream();
var builder = new ConnectionBuilder(sp);
var builder = new SocketBuilder(sp);
builder.UseEndPoint<TestEndPoint>();
var app = builder.Build();
var options = new HttpSocketOptions();
@ -1117,7 +1116,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
var services = new ServiceCollection();
services.AddEndPoint<TestEndPoint>();
var builder = new ConnectionBuilder(services.BuildServiceProvider());
var builder = new SocketBuilder(services.BuildServiceProvider());
builder.UseEndPoint<TestEndPoint>();
var app = builder.Build();
var options = new HttpSocketOptions();
@ -1197,7 +1196,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
var qs = new QueryCollection(values);
context.Request.Query = qs;
var builder = new ConnectionBuilder(services.BuildServiceProvider());
var builder = new SocketBuilder(services.BuildServiceProvider());
builder.UseEndPoint<ImmediatelyCompleteEndPoint>();
var app = builder.Build();
var options = new HttpSocketOptions();

View File

@ -10,7 +10,6 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Hosting.Server.Features;
using Microsoft.AspNetCore.Protocols;
using Microsoft.AspNetCore.Testing.xunit;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;