public void StartAndCloseSession() { var requestStr = ConfigurationManager.AppSettings["smallTestFile"]; Uri uri; Uri.TryCreate(TestHelpers.GetAddress() + requestStr, UriKind.Absolute, out uri); bool gotException = false; var stream = TestHelpers.GetHandshakedStream(uri); try { using ( var adapter = new Http2ClientMessageHandler(stream, ConnectionEnd.Client, TestHelpers.UseSecurePort, new CancellationToken())) { adapter.StartSessionAsync(); } } catch (Exception) { gotException = true; } Assert.Equal(gotException, false); }
public async void StartConnection() { Console.WriteLine("Start connection called"); if (_useHttp20 && !_sessionAdapter.IsDisposed && !_isDisposed) { Dictionary <string, string> initialRequest = null; if (!_isSecure) { initialRequest = new Dictionary <string, string> { { CommonHeaders.Path, _path }, }; } await _sessionAdapter.StartSessionAsync(initialRequest); //GC.Collect(); } if (!_sessionAdapter.IsDisposed) { return; } Http2Logger.LogError("Connection was aborted by the remote side. Check your session header."); Dispose(true); }