@Override
        protected void configure(ServerBuilder sb) {
            sb.workerGroup(1);
            sb.maxRequestLength(MAX_MESSAGE_SIZE);
            sb.idleTimeoutMillis(0);
            sb.http(0);
            sb.https(0);
            sb.tlsSelfSigned();

            final ServerInterceptor clientHeaderCaptureInterceptor = new ServerInterceptor() {
                @Override
                public <REQ, RESP> Listener<REQ> interceptCall(
                        ServerCall<REQ, RESP> call,
                        Metadata requestHeaders,
                        ServerCallHandler<REQ, RESP> next) {
                    final HttpHeadersBuilder fromClient = HttpHeaders.builder();
                    MetadataUtil.fillHeaders(requestHeaders, fromClient);
                    CLIENT_HEADERS_CAPTURE.set(fromClient.build());
                    return next.startCall(
                            new SimpleForwardingServerCall<REQ, RESP>(call) {
                                @Override
                                public void close(Status status, Metadata trailers) {
                                    trailers.merge(requestHeaders);
                                    super.close(status, trailers);
                                }
                            }, requestHeaders);
                }
            };
            sb.serviceUnder("/",
                            GrpcService.builder()
                                       .addService(new TestServiceImpl(
                                               Executors.newSingleThreadScheduledExecutor()))
                                       .addService(new UnitTestServiceImpl())
                                       .intercept(clientHeaderCaptureInterceptor)
                                       .maxRequestMessageLength(MAX_MESSAGE_SIZE)
                                       .maxResponseMessageLength(MAX_MESSAGE_SIZE)
                                       .useClientTimeoutHeader(false)
                                       .build()
                                       .decorate((service, ctx, req) -> {
                                           final HttpResponse res = service.serve(ctx, req);
                                           return res.peekTrailers(SERVER_TRAILERS_CAPTURE::set);
                                       }));
        }
Must be at least {@link #unaryPayloadLength()}, plus some to account for encoding overhead.
grpc/src/test/java/com/linecorp/armeria/client/grpc/GrpcClientTest.java