public void NetworkPipeline_Fragmentation_SendRecvMaxSize() { var clientPipe = m_ClientDriver.CreatePipeline(typeof(FragmentationPipelineStage)); var serverPipe = m_ServerDriver.CreatePipeline(typeof(FragmentationPipelineStage)); // Connect to server var clientToServer = m_ClientDriver.Connect(m_ServerDriver.LocalEndPoint()); Assert.AreNotEqual(default(NetworkConnection), clientToServer); m_ClientDriver.ScheduleUpdate().Complete(); // Handle incoming connection from client m_ServerDriver.ScheduleUpdate().Complete(); var serverToClient = m_ServerDriver.Accept(); Assert.AreNotEqual(default(NetworkConnection), serverToClient); int messageSize = 4 * 1024 - m_ServerDriver.MaxHeaderSize(serverPipe); // Send message to client if (m_ServerDriver.BeginSend(serverPipe, serverToClient, out var strm, messageSize) == 0) { for (int i = 0; i < messageSize; ++i) { strm.WriteByte((byte)i); } m_ServerDriver.EndSend(strm); } m_ServerDriver.ScheduleUpdate().Complete(); // Receive incoming message from server m_ClientDriver.ScheduleUpdate().Complete(); DataStreamReader readStrm; Assert.AreEqual(NetworkEvent.Type.Connect, clientToServer.PopEvent(m_ClientDriver, out readStrm)); Assert.AreEqual(NetworkEvent.Type.Data, clientToServer.PopEvent(m_ClientDriver, out readStrm)); Assert.AreEqual(messageSize, readStrm.Length); for (int i = 0; i < messageSize; ++i) { Assert.AreEqual((byte)i, readStrm.ReadByte()); } }