Пример #1
0
        private static async Task <int> EstablishConnectionAndProcessOneRequestAsync(HttpClient client, Http2LoopbackServer server)
        {
            // Establish connection and send initial request/response to ensure connection is available for subsequent use
            Task <HttpResponseMessage> sendTask = client.GetAsync(server.Address);

            await server.EstablishConnectionAsync();

            int streamId = await server.ReadRequestHeaderAsync();

            await server.SendDefaultResponseAsync(streamId);

            HttpResponseMessage response = await sendTask;

            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
            Assert.Equal(0, (await response.Content.ReadAsByteArrayAsync()).Length);

            return(streamId);
        }