diff --git a/Assets/Mirror/Runtime/Transport/FallbackTransport.cs b/Assets/Mirror/Runtime/Transport/FallbackTransport.cs index 149cc59ec..a66f04dbb 100644 --- a/Assets/Mirror/Runtime/Transport/FallbackTransport.cs +++ b/Assets/Mirror/Runtime/Transport/FallbackTransport.cs @@ -8,6 +8,7 @@ namespace Mirror { [HelpURL("https://mirror-networking.gitbook.io/docs/transports/fallback-transport")] [DisallowMultipleComponent] + [Obsolete("Fallback Transport will be retired. It was only needed for Apathy/Libuv. Use kcp or Telepathy instead, those run everywhere.")] public class FallbackTransport : Transport { public Transport[] transports; diff --git a/Assets/Mirror/Tests/Editor/FallbackTransportTest.cs b/Assets/Mirror/Tests/Editor/FallbackTransportTest.cs deleted file mode 100644 index ff904ab8f..000000000 --- a/Assets/Mirror/Tests/Editor/FallbackTransportTest.cs +++ /dev/null @@ -1,177 +0,0 @@ -using System; -using NSubstitute; -using NUnit.Framework; -using UnityEngine; - -namespace Mirror.Tests -{ - public class FallbackTransportTest - { - - Transport transport1; - Transport transport2; - FallbackTransport transport; - - [SetUp] - public void Setup() - { - transport1 = Substitute.For(); - transport2 = Substitute.For(); - - GameObject gameObject = new GameObject(); - - transport = gameObject.AddComponent(); - transport.transports = new[] { transport1, transport2 }; - } - - [TearDown] - public void TearDown() - { - GameObject.DestroyImmediate(transport.gameObject); - } - - #region Client tests - // A Test behaves as an ordinary method - [Test] - public void TestAvailable() - { - transport1.Available().Returns(true); - transport2.Available().Returns(false); - transport.Awake(); - - Assert.That(transport.Available()); - } - - // A Test behaves as an ordinary method - [Test] - public void TestNotAvailable() - { - transport1.Available().Returns(false); - transport2.Available().Returns(false); - - Assert.Throws(() => transport.Awake()); - - } - - // A Test behaves as an ordinary method - [Test] - public void TestConnect() - { - transport1.Available().Returns(false); - transport2.Available().Returns(true); - transport.Awake(); - - transport.ClientConnect("some.server.com"); - - transport1.DidNotReceive().ClientConnect(Arg.Any()); - transport2.Received().ClientConnect("some.server.com"); - } - - [Test] - public void TestConnected() - { - transport1.Available().Returns(true); - transport.Awake(); - transport.ClientConnect("some.server.com"); - - transport1.ClientConnected().Returns(true); - - Assert.That(transport.ClientConnected()); - } - - [Test] - public void TestDisconnect() - { - transport1.Available().Returns(true); - transport.Awake(); - transport.ClientConnect("some.server.com"); - - transport.ClientDisconnect(); - - transport1.Received().ClientDisconnect(); - } - - [Test] - public void TestClientSend() - { - transport1.Available().Returns(true); - transport.Awake(); - - transport.ClientConnect("some.server.com"); - - byte[] data = { 1, 2, 3 }; - ArraySegment segment = new ArraySegment(data); - - transport.ClientSend(3, segment); - - transport1.Received().ClientSend(3, segment); - } - - [Test] - public void TestClient1Connected() - { - transport1.Available().Returns(true); - transport2.Available().Returns(true); - - Action callback = Substitute.For(); - // find available - transport.Awake(); - // set event and connect to give event to inner - transport.OnClientConnected = callback; - transport.ClientConnect("localhost"); - transport1.OnClientConnected.Invoke(); - callback.Received().Invoke(); - } - - [Test] - public void TestClient2Connected() - { - transport1.Available().Returns(false); - transport2.Available().Returns(true); - - Action callback = Substitute.For(); - // find available - transport.Awake(); - // set event and connect to give event to inner - transport.OnClientConnected = callback; - transport.ClientConnect("localhost"); - transport2.OnClientConnected.Invoke(); - callback.Received().Invoke(); - } - - #endregion - - #region Server tests - - [Test] - public void TestServerConnected() - { - byte[] data = { 1, 2, 3 }; - ArraySegment segment = new ArraySegment(data); - - transport1.Available().Returns(true); - transport2.Available().Returns(true); - // find available - transport.Awake(); - - - // on connect, send a message back - void SendMessage(int connectionId) - { - transport.ServerSend(connectionId, 5, segment); - } - - // set event and Start to give event to inner - transport.OnServerConnected = SendMessage; - transport.ServerStart(); - - transport1.OnServerConnected.Invoke(1); - - transport1.Received().ServerSend(1, 5, segment); - } - - - #endregion - - } -} diff --git a/Assets/Mirror/Tests/Editor/FallbackTransportTest.cs.meta b/Assets/Mirror/Tests/Editor/FallbackTransportTest.cs.meta deleted file mode 100644 index cf293731f..000000000 --- a/Assets/Mirror/Tests/Editor/FallbackTransportTest.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ea6c7ecc5045248278e238f5d15a8416 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: