Skip to content

Commit

Permalink
Activate Quic Alpn Narrowing Test (#91116)
Browse files Browse the repository at this point in the history
* Delete ActiveIssue

* Disable Not Existing Inline Data

* Delete connection accept

* Merge assert and variable

* Add listener throws case

* Update src/libraries/System.Net.Quic/tests/FunctionalTests/QuicListenerTests.cs

Co-authored-by: Marie Píchová <11718369+ManickaP@users.noreply.github.com>

---------

Co-authored-by: Marie Píchová <11718369+ManickaP@users.noreply.github.com>
  • Loading branch information
liveans and ManickaP authored Sep 4, 2023
1 parent a7336b1 commit 7329c4b
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,6 @@ public async Task Listener_AlpnNarrowingDown_Success()
Assert.Equal(new SslApplicationProtocol("test"), clientConnection2.NegotiatedApplicationProtocol);
}

[ActiveIssue("https://github.com/dotnet/runtime/issues/86701")]
[Theory]
[InlineData("foo")]
[InlineData("not_existing")]
Expand Down Expand Up @@ -503,15 +502,18 @@ public async Task Listener_AlpnNarrowingDown_Failure(string alpn)
return ValueTask.FromResult(options);
}
};
bool isAlpnPresentOnInitialAlpnList = listenerOptions.ApplicationProtocols.Contains(new SslApplicationProtocol(alpn)); // If the ALPN is not present on initial list, AcceptConnectionAsync will not throw AuthenticationException.
await using QuicListener listener = await CreateQuicListener(listenerOptions);

QuicClientConnectionOptions clientOptions = CreateQuicClientOptions(listener.LocalEndPoint);
clientOptions.ClientAuthenticationOptions.ApplicationProtocols = new()
{
new SslApplicationProtocol(alpn),
};
ValueTask<QuicConnection> connectTask = CreateQuicConnection(clientOptions);
await Assert.ThrowsAsync<AuthenticationException>(() => listener.AcceptConnectionAsync().AsTask().WaitAsync(timeoutToken));
if (isAlpnPresentOnInitialAlpnList)
{
await Assert.ThrowsAsync<AuthenticationException>(() => listener.AcceptConnectionAsync().AsTask().WaitAsync(timeoutToken));
}
await Assert.ThrowsAsync<AuthenticationException>(() => connectTask.AsTask().WaitAsync(timeoutToken));
}
}
Expand Down

0 comments on commit 7329c4b

Please sign in to comment.