mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-20 03:24:33 +08:00
Expose local endpoint in channel adapter (#2213)
* Expose local endpoint * Update release notes
This commit is contained in:
@@ -14,8 +14,28 @@ namespace MQTTnet.Tests.Server;
|
||||
|
||||
// ReSharper disable InconsistentNaming
|
||||
[TestClass]
|
||||
public sealed class Security_Tests : BaseTestClass
|
||||
public class Security_Tests : BaseTestClass
|
||||
{
|
||||
[TestMethod]
|
||||
public async Task Deny_Connection()
|
||||
{
|
||||
using var testEnvironment = CreateTestEnvironment();
|
||||
testEnvironment.IgnoreClientLogErrors = true;
|
||||
|
||||
var server = await testEnvironment.StartServer();
|
||||
|
||||
server.ValidatingConnectionAsync += e =>
|
||||
{
|
||||
e.ReasonCode = MqttConnectReasonCode.NotAuthorized;
|
||||
return CompletedTask.Instance;
|
||||
};
|
||||
|
||||
var client = testEnvironment.CreateClient();
|
||||
var response = await client.ConnectAsync(testEnvironment.CreateDefaultClientOptions());
|
||||
|
||||
Assert.AreEqual(MqttClientConnectResultCode.NotAuthorized, response.ResultCode);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task Do_Not_Affect_Authorized_Clients()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user