fix(MiddlewareTransport): Implement OnServerConnectedWithAddress

This commit is contained in:
MrGadget 2024-07-11 11:27:16 -04:00
parent e6f2768aaa
commit 63b7113ec9
2 changed files with 8 additions and 7 deletions

View File

@ -292,13 +292,13 @@ public void TestClientExceptionCallback()
}
[Test]
[TestCase(0)]
[TestCase(1)]
[TestCase(19)]
public void TestServerConnectedCallback(int id)
[TestCase(0, "")]
[TestCase(1, "")]
[TestCase(19, "")]
public void TestServerConnectedCallback(int id, string remoteClientAddress)
{
int called = 0;
middleware.OnServerConnected = (i) =>
middleware.OnServerConnectedWithAddress = (i, remoteClientAddress) =>
{
called++;
Assert.That(i, Is.EqualTo(id));
@ -306,10 +306,10 @@ public void TestServerConnectedCallback(int id)
// start to give callback to inner
middleware.ServerStart();
inner.OnServerConnected.Invoke(id);
inner.OnServerConnectedWithAddress.Invoke(id, remoteClientAddress);
Assert.That(called, Is.EqualTo(1));
inner.OnServerConnected.Invoke(id);
inner.OnServerConnectedWithAddress.Invoke(id, remoteClientAddress);
Assert.That(called, Is.EqualTo(2));
}

View File

@ -43,6 +43,7 @@ public override void ClientConnect(string address)
public override void ServerStart()
{
inner.OnServerConnected = OnServerConnected;
inner.OnServerConnectedWithAddress = OnServerConnectedWithAddress;
inner.OnServerDataReceived = OnServerDataReceived;
inner.OnServerDisconnected = OnServerDisconnected;
inner.OnServerError = OnServerError;