public void GetBytes() { var statusActionInvocations = new List<SftpStatusResponse>(); var nameActionInvocations = new List<SftpNameResponse>(); Action<SftpStatusResponse> statusAction = statusActionInvocations.Add; Action<SftpNameResponse> nameAction = nameActionInvocations.Add; var request = new SftpRealPathRequest( _protocolVersion, _requestId, _path, _encoding, nameAction, statusAction); var bytes = request.GetBytes(); var expectedBytesLength = 0; #if TUNING expectedBytesLength += 4; // Length #endif expectedBytesLength += 1; // Type expectedBytesLength += 4; // RequestId expectedBytesLength += 4; // Path length expectedBytesLength += _pathBytes.Length; // Path Assert.AreEqual(expectedBytesLength, bytes.Length); var sshDataStream = new SshDataStream(bytes); #if TUNING Assert.AreEqual((uint)bytes.Length - 4, sshDataStream.ReadUInt32()); #endif Assert.AreEqual((byte)SftpMessageTypes.RealPath, sshDataStream.ReadByte()); Assert.AreEqual(_requestId, sshDataStream.ReadUInt32()); Assert.AreEqual((uint) _pathBytes.Length, sshDataStream.ReadUInt32()); var actualPath = new byte[_pathBytes.Length]; sshDataStream.Read(actualPath, 0, actualPath.Length); Assert.IsTrue(_pathBytes.SequenceEqual(actualPath)); Assert.IsTrue(sshDataStream.IsEndOfData); }