diff --git a/src/libraries/Common/src/System/Net/Http/aspnetcore/Quic/Implementations/Mock/MockConnection.cs b/src/libraries/Common/src/System/Net/Http/aspnetcore/Quic/Implementations/Mock/MockConnection.cs
index cba2f936ef8dd2..b97f4876bfa7f2 100644
--- a/src/libraries/Common/src/System/Net/Http/aspnetcore/Quic/Implementations/Mock/MockConnection.cs
+++ b/src/libraries/Common/src/System/Net/Http/aspnetcore/Quic/Implementations/Mock/MockConnection.cs
@@ -74,7 +74,7 @@ internal override async ValueTask ConnectAsync(CancellationToken cancellationTok
}
Socket socket = new Socket(_remoteEndPoint!.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
- await socket.ConnectAsync(_remoteEndPoint).ConfigureAwait(false);
+ await socket.ConnectAsync(_remoteEndPoint, cancellationToken).ConfigureAwait(false);
socket.NoDelay = true;
_localEndPoint = (IPEndPoint?)socket.LocalEndPoint;
diff --git a/src/libraries/System.Net.Connections/src/System.Net.Connections.csproj b/src/libraries/System.Net.Connections/src/System.Net.Connections.csproj
index 7ccd9e6f600ab5..cf6682f2cd821e 100644
--- a/src/libraries/System.Net.Connections/src/System.Net.Connections.csproj
+++ b/src/libraries/System.Net.Connections/src/System.Net.Connections.csproj
@@ -18,7 +18,6 @@
-
diff --git a/src/libraries/System.Net.Connections/src/System/Net/Connections/Sockets/SocketsConnectionFactory.cs b/src/libraries/System.Net.Connections/src/System/Net/Connections/Sockets/SocketsConnectionFactory.cs
index 2936a04e0484cc..732ad9447828a5 100644
--- a/src/libraries/System.Net.Connections/src/System/Net/Connections/Sockets/SocketsConnectionFactory.cs
+++ b/src/libraries/System.Net.Connections/src/System/Net/Connections/Sockets/SocketsConnectionFactory.cs
@@ -64,27 +64,7 @@ public override async ValueTask ConnectAsync(
try
{
- using var args = new TaskSocketAsyncEventArgs();
- args.RemoteEndPoint = endPoint;
-
- if (socket.ConnectAsync(args))
- {
- using (cancellationToken.UnsafeRegister(static o => Socket.CancelConnectAsync((SocketAsyncEventArgs)o!), args))
- {
- await args.Task.ConfigureAwait(false);
- }
- }
-
- if (args.SocketError != SocketError.Success)
- {
- if (args.SocketError == SocketError.OperationAborted)
- {
- cancellationToken.ThrowIfCancellationRequested();
- }
-
- throw NetworkErrorHelper.MapSocketException(new SocketException((int)args.SocketError));
- }
-
+ await socket.ConnectAsync(endPoint, cancellationToken).ConfigureAwait(false);
return new SocketConnection(socket);
}
catch (SocketException socketException)
diff --git a/src/libraries/System.Net.Connections/src/System/Net/Connections/Sockets/TaskSocketAsyncEventArgs.cs b/src/libraries/System.Net.Connections/src/System/Net/Connections/Sockets/TaskSocketAsyncEventArgs.cs
deleted file mode 100644
index a1bb69d3f0501e..00000000000000
--- a/src/libraries/System.Net.Connections/src/System/Net/Connections/Sockets/TaskSocketAsyncEventArgs.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-using System.Net.Sockets;
-using System.Threading.Tasks;
-using System.Threading.Tasks.Sources;
-
-namespace System.Net.Connections
-{
- internal sealed class TaskSocketAsyncEventArgs : SocketAsyncEventArgs, IValueTaskSource
- {
- private ManualResetValueTaskSourceCore _valueTaskSource;
-
- public void ResetTask() => _valueTaskSource.Reset();
- public ValueTask Task => new ValueTask(this, _valueTaskSource.Version);
-
- public void GetResult(short token) => _valueTaskSource.GetResult(token);
- public ValueTaskSourceStatus GetStatus(short token) => _valueTaskSource.GetStatus(token);
- public void OnCompleted(Action