public void BigBytesData(int length) { NetMQMessage plainMessage = new NetMQMessage(); plainMessage.Append(new byte[length]); new Random().NextBytes(plainMessage[0].Buffer); byte[] data = m_serverSecureChannel.EncryptApplicationBytes(plainMessage[0].Buffer); List <NetMQMessage> sslMessages = new List <NetMQMessage>(); int o = 0; bool result = m_clientSecureChannel.ResolveRecordLayer(data, out o, out sslMessages); List <NetMQMessage> plainMessages = new List <NetMQMessage>(); foreach (var netmq in sslMessages) { //大包合并包 plainMessages.Add(m_clientSecureChannel.DecryptApplicationMessage(netmq)); } Assert.AreEqual(plainMessage.Sum(p => p.BufferSize), plainMessages.Sum(f => f.Sum(p => p.BufferSize))); byte[] encryptBytes = new byte[plainMessages.Sum(e => e.Sum(f => f.BufferSize))]; int offset = 0; foreach (var p in plainMessages) { foreach (var frame in p) { Buffer.BlockCopy(frame.Buffer, 0, encryptBytes, offset, frame.BufferSize); offset += frame.BufferSize; } } Assert.AreEqual(plainMessage[0].Buffer, encryptBytes); }