public async void Settings_Disable_Push_Promise () { var url = new Uri ("http://localhost:8999/index.html"); var settings = new Http2ConnectionSettings (url) { DisablePushPromise = true }; var http = new Http2Client (settings); await http.Connect (); var didAck = false; var semaphoreSettings = new SemaphoreSlim (0); var cancelTokenSource = new CancellationTokenSource (); var connectionStream = await http.StreamManager.Get (0); connectionStream.OnFrameReceived += (frame) => { // Watch for an ack'd settings frame after we sent the frame with no push promise if (frame.Type == FrameType.Settings) { if ((frame as SettingsFrame).Ack) { didAck = true; semaphoreSettings.Release (); } } }; cancelTokenSource.CancelAfter (TimeSpan.FromSeconds (2)); await semaphoreSettings.WaitAsync (cancelTokenSource.Token); Assert.IsTrue (didAck); }
public async void Settings_Disable_Push_Promise() { var url = new Uri("http://localhost:8999/index.html"); var settings = new Http2ConnectionSettings(url) { DisablePushPromise = true }; var http = new Http2Client(settings); await http.Connect(); var didAck = false; var semaphoreSettings = new SemaphoreSlim(0); var cancelTokenSource = new CancellationTokenSource(); var connectionStream = await http.StreamManager.Get(0); connectionStream.OnFrameReceived += (frame) => { // Watch for an ack'd settings frame after we sent the frame with no push promise if (frame.Type == FrameType.Settings) { if ((frame as SettingsFrame).Ack) { didAck = true; semaphoreSettings.Release(); } } }; cancelTokenSource.CancelAfter(TimeSpan.FromSeconds(2)); await semaphoreSettings.WaitAsync(cancelTokenSource.Token); Assert.IsTrue(didAck); }
public async void GoAway() { var uri = new Uri("http://localhost:8999/index.html"); var http = new Http2Client(uri); await http.Connect(); var cancelTokenSource = new CancellationTokenSource(); cancelTokenSource.CancelAfter(TimeSpan.FromSeconds(2)); var sentGoAway = await http.Disconnect(); Assert.IsTrue(sentGoAway); }
static async Task sendHttp2() { // Uri to request var uri = new Uri("https://localhost:8443/"); // Create a Http2Client var http2 = new Http2Client(uri); // Specify any custom headers var headers = new NameValueCollection(); headers.Add("some-header", "value"); // For some requests you may have a request body byte[] data = null; http2.Connect(); //var response = await http2.Send(uri, HttpMethod.Get, headers, data); }
public async void GoAway () { var uri = new Uri ("http://localhost:8999/index.html"); var http = new Http2Client (uri); await http.Connect (); var cancelTokenSource = new CancellationTokenSource (); cancelTokenSource.CancelAfter (TimeSpan.FromSeconds (2)); var sentGoAway = await http.Disconnect (); Assert.IsTrue (sentGoAway); }