Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change using in ConnectCallback_UseUnixDomainSocket_Success #44366

Merged
merged 1 commit into from
Nov 8, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2476,22 +2476,26 @@ public async Task ConnectCallback_UseUnixDomainSocket_Success(bool useSsl)
return new NetworkStream(clientSocket, ownsSocket: true);
};

using HttpClient client = CreateHttpClient(handler);
client.DefaultVersionPolicy = HttpVersionPolicy.RequestVersionExact;
using (HttpClient client = CreateHttpClient(handler))
{
client.DefaultVersionPolicy = HttpVersionPolicy.RequestVersionExact;

Task<string> clientTask = client.GetStringAsync($"{(options.UseSsl ? "https" : "http")}://{guid}/foo");
Task<string> clientTask = client.GetStringAsync($"{(options.UseSsl ? "https" : "http")}://{guid}/foo");

Socket serverSocket = await listenSocket.AcceptAsync();
using GenericLoopbackConnection loopbackConnection = await LoopbackServerFactory.CreateConnectionAsync(socket: null, new NetworkStream(serverSocket, ownsSocket: true), options);
await loopbackConnection.InitializeConnectionAsync();
Socket serverSocket = await listenSocket.AcceptAsync();
using (GenericLoopbackConnection loopbackConnection = await LoopbackServerFactory.CreateConnectionAsync(socket: null, new NetworkStream(serverSocket, ownsSocket: true), options))
{
await loopbackConnection.InitializeConnectionAsync();

HttpRequestData requestData = await loopbackConnection.ReadRequestDataAsync();
Assert.Equal("/foo", requestData.Path);
HttpRequestData requestData = await loopbackConnection.ReadRequestDataAsync();
Assert.Equal("/foo", requestData.Path);

await loopbackConnection.SendResponseAsync(content: "foo");
await loopbackConnection.SendResponseAsync(content: "foo");

string response = await clientTask;
Assert.Equal("foo", response);
string response = await clientTask;
Assert.Equal("foo", response);
}
}
}

[Theory]
Expand Down