requestObserver
= asyncStub.fullDuplexCall(responseObserver);
requestObserver.onNext(streamingRequest);
diff --git a/interop-testing/src/test/java/io/grpc/testing/integration/InProcessTest.java b/interop-testing/src/test/java/io/grpc/testing/integration/InProcessTest.java
index 9e26f2abca..d1db91a146 100644
--- a/interop-testing/src/test/java/io/grpc/testing/integration/InProcessTest.java
+++ b/interop-testing/src/test/java/io/grpc/testing/integration/InProcessTest.java
@@ -65,8 +65,18 @@ public class InProcessTest extends AbstractInteropTest {
@Override
protected boolean metricsExpected() {
- // TODO(zhangkun83): InProcessTransport by-passes framer and deframer, thus message sizses are
+ // TODO(zhangkun83): InProcessTransport by-passes framer and deframer, thus message sizes are
// not counted. (https://github.com/grpc/grpc-java/issues/2284)
return false;
}
+
+ @Override
+ public void maxInboundSize_tooBig() {
+ // noop, not enforced.
+ }
+
+ @Override
+ public void maxOutboundSize_tooBig() {
+ // noop, not enforced.
+ }
}
diff --git a/stub/src/main/java/io/grpc/stub/AbstractStub.java b/stub/src/main/java/io/grpc/stub/AbstractStub.java
index 87f0e56482..f66ccb4260 100644
--- a/stub/src/main/java/io/grpc/stub/AbstractStub.java
+++ b/stub/src/main/java/io/grpc/stub/AbstractStub.java
@@ -40,6 +40,7 @@ import io.grpc.ClientInterceptor;
import io.grpc.ClientInterceptors;
import io.grpc.Deadline;
import io.grpc.ExperimentalApi;
+import io.grpc.ManagedChannelBuilder;
import java.util.concurrent.TimeUnit;
@@ -189,4 +190,22 @@ public abstract class AbstractStub> {
public final S withWaitForReady() {
return build(channel, callOptions.withWaitForReady());
}
+
+ /**
+ * Returns a new stub that limits the maximum acceptable message size from a remote peer.
+ *
+ * If unset, the {@link ManagedChannelBuilder#maxInboundMessageSize(int)} limit is used.
+ */
+ @ExperimentalApi("https://github.com/grpc/grpc-java/issues/2563")
+ public final S withMaxInboundMessageSize(int maxSize) {
+ return build(channel, callOptions.withMaxInboundMessageSize(maxSize));
+ }
+
+ /**
+ * Returns a new stub that limits the maximum acceptable message size to send a remote peer.
+ */
+ @ExperimentalApi("https://github.com/grpc/grpc-java/issues/2563")
+ public final S withMaxOutboundMessageSize(int maxSize) {
+ return build(channel, callOptions.withMaxOutboundMessageSize(maxSize));
+ }
}