fix(MultiplexTransportTest): Update tests to use OnServerConnectedWithAddress

This commit is contained in:
MrGadget 2024-07-20 13:07:35 -04:00
parent 1968ef9f9b
commit 8b6bc74629

View File

@ -238,16 +238,16 @@ public void TestServerConnected()
ArraySegment<byte> segment = new ArraySegment<byte>(data); ArraySegment<byte> segment = new ArraySegment<byte>(data);
// on connect, send a message back // on connect, send a message back
void SendMessage(int connectionId) void SendMessage(int connectionId, string remoteClientAddress)
{ {
transport.ServerSend(connectionId, segment, 5); transport.ServerSend(connectionId, segment, 5);
} }
// set event and Start to give event to inner // set event and Start to give event to inner
transport.OnServerConnected = SendMessage; transport.OnServerConnectedWithAddress = SendMessage;
transport.ServerStart(); transport.ServerStart();
transport1.OnServerConnected.Invoke(1); transport1.OnServerConnectedWithAddress.Invoke(1, "");
transport1.Received().ServerSend(1, segment, 5); transport1.Received().ServerSend(1, segment, 5);
} }
@ -260,14 +260,14 @@ public void TestServerSend()
transport.ServerStart(); transport.ServerStart();
transport.ClientConnect("some.server.com"); transport.ClientConnect("some.server.com");
transport.OnServerConnected = _ => {}; transport.OnServerConnectedWithAddress = (_,_) => {};
transport.OnServerDisconnected = _ => {}; transport.OnServerDisconnected = _ => {};
// connect two connectionIds. // connect two connectionIds.
// one of them very large to prevent // one of them very large to prevent
// https://github.com/vis2k/Mirror/issues/3280 // https://github.com/vis2k/Mirror/issues/3280
transport1.OnServerConnected(10); transport1.OnServerConnectedWithAddress(10, "");
transport2.OnServerConnected(int.MaxValue); transport2.OnServerConnectedWithAddress(int.MaxValue, "");
byte[] data = { 1, 2, 3 }; byte[] data = { 1, 2, 3 };
ArraySegment<byte> segment = new ArraySegment<byte>(data); ArraySegment<byte> segment = new ArraySegment<byte>(data);