aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/csharp/Grpc.Core.Tests/CompressionTest.cs
diff options
context:
space:
mode:
authorGravatar Sree Kuchibhotla <sreek@google.com>2016-06-23 09:23:01 -0700
committerGravatar Sree Kuchibhotla <sreek@google.com>2016-06-23 09:23:01 -0700
commit05fd4fe0436fadeb7c10bba2c326c9687d485a8d (patch)
tree27a37a9398c80583cda23504725cfc78020594a0 /src/csharp/Grpc.Core.Tests/CompressionTest.cs
parent0224dcc2dcda932a171776de325fa2e66c95478f (diff)
parent60e98ec3feab9cc347d6eacb48fb98cecb88c089 (diff)
Merge branch 'master' into epoll_changes
Diffstat (limited to 'src/csharp/Grpc.Core.Tests/CompressionTest.cs')
-rw-r--r--src/csharp/Grpc.Core.Tests/CompressionTest.cs26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/csharp/Grpc.Core.Tests/CompressionTest.cs b/src/csharp/Grpc.Core.Tests/CompressionTest.cs
index 378c81851c..16be210508 100644
--- a/src/csharp/Grpc.Core.Tests/CompressionTest.cs
+++ b/src/csharp/Grpc.Core.Tests/CompressionTest.cs
@@ -34,6 +34,7 @@
using System;
using System.Diagnostics;
using System.Linq;
+using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Grpc.Core;
@@ -118,5 +119,30 @@ namespace Grpc.Core.Tests
await call.ResponseStream.ToListAsync();
}
+
+ [Test]
+ public void CanReadCompressedMessages()
+ {
+ var compressionMetadata = new Metadata
+ {
+ { new Metadata.Entry(Metadata.CompressionRequestAlgorithmMetadataKey, "gzip") }
+ };
+
+ helper.UnaryHandler = new UnaryServerMethod<string, string>(async (req, context) =>
+ {
+ await context.WriteResponseHeadersAsync(compressionMetadata);
+ return req;
+ });
+
+ var stringBuilder = new StringBuilder();
+ for (int i = 0; i < 200000; i++)
+ {
+ stringBuilder.Append('a');
+ }
+ var request = stringBuilder.ToString();
+ var response = Calls.BlockingUnaryCall(helper.CreateUnaryCall(new CallOptions(compressionMetadata)), request);
+
+ Assert.AreEqual(request, response);
+ }
}
}