mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
NetworkServerTests: ConnectDuplicateConnectionIdsTest
This commit is contained in:
parent
9c325abbd8
commit
ad0d20144a
@ -167,6 +167,32 @@ public void OnConnectedOnlyAllowsGreaterZeroConnectionIdsTest()
|
|||||||
NetworkServer.Shutdown();
|
NetworkServer.Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ConnectDuplicateConnectionIdsTest()
|
||||||
|
{
|
||||||
|
// message handlers
|
||||||
|
NetworkServer.RegisterHandler<ConnectMessage>((conn, msg) => {}, false);
|
||||||
|
NetworkServer.RegisterHandler<DisconnectMessage>((conn, msg) => {}, false);
|
||||||
|
NetworkServer.RegisterHandler<ErrorMessage>((conn, msg) => {}, false);
|
||||||
|
|
||||||
|
// listen
|
||||||
|
NetworkServer.Listen(2);
|
||||||
|
Assert.That(NetworkServer.connections.Count, Is.EqualTo(0));
|
||||||
|
|
||||||
|
// connect first
|
||||||
|
Transport.activeTransport.OnServerConnected.Invoke(42);
|
||||||
|
Assert.That(NetworkServer.connections.Count, Is.EqualTo(1));
|
||||||
|
NetworkConnectionToClient original = NetworkServer.connections[42];
|
||||||
|
|
||||||
|
// connect duplicate - shouldn't overwrite first one
|
||||||
|
Transport.activeTransport.OnServerConnected.Invoke(42);
|
||||||
|
Assert.That(NetworkServer.connections.Count, Is.EqualTo(1));
|
||||||
|
Assert.That(NetworkServer.connections[42], Is.EqualTo(original));
|
||||||
|
|
||||||
|
// shutdown
|
||||||
|
NetworkServer.Shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void SetLocalConnectionTest()
|
public void SetLocalConnectionTest()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user