public void Setup()
        {
            var port   = Utils.GetRandomClientPort();
            var random = new Random();

            data = new byte[MessageBytes];
            random.NextBytes(data);

            server = new ConcurrentFlareTcpServer();
            client = new FlareTcpClient();
            server.MessageReceived += (clientId, message) => {
                server.EnqueueMessage(clientId, message);
            };
            _ = Task.Run(() => server.ListenAsync(port));
            client.Connect(IPAddress.Loopback, port);
        }
        public static void CanSendMessage()
        {
            var port = Utils.GetRandomClientPort();

            byte[] testMessage = Encoding.UTF8.GetBytes("Test");

            using var server        = new ConcurrentFlareTcpServer();
            server.ClientConnected += clientId => {
                server.EnqueueMessage(clientId, testMessage);
            };
            var listenTask = Task.Run(() => server.ListenAsync(port));

            using var client = new FlareTcpClient();
            client.Connect(IPAddress.Loopback, port);
            using var message = client.ReadNextMessage();
            Assert.AreEqual(message.Span.ToArray(), testMessage);
            client.Disconnect();
            server.Shutdown();
            Assert.IsTrue(listenTask.Wait(TimeSpan.FromSeconds(5)));
        }
        public static async Task CanSendMessageAndFree()
        {
            var port = Utils.GetRandomClientPort();

            byte[] testMessage = Encoding.UTF8.GetBytes("Test");

            using var server        = new ConcurrentFlareTcpServer();
            server.MessageReceived += (clientId, message) => {
                server.EnqueueMessage(clientId, message);
            };
            var listenTask = Task.Run(() => server.ListenAsync(port));

            using var client = new FlareTcpClient();
            client.Connect(IPAddress.Loopback, port);
            client.WriteMessage(testMessage);
            using var message = client.ReadNextMessage();
            Assert.AreEqual(message.Span.ToArray(), testMessage);
            client.Disconnect();
            server.Shutdown();
            await Utils.WithTimeout(listenTask, TimeSpan.FromSeconds(5));
        }