@Test
    void credentialsUnaryCall() {
        final TestServiceBlockingStub stub =
                // Explicitly construct URL to better test authority.
                GrpcClients.builder("gproto+http://localhost:" + server.httpPort())
                           .build(TestServiceBlockingStub.class)
                           .withCallCredentials(
                                   new CallCredentials() {
                                       @Override
                                       public void applyRequestMetadata(RequestInfo requestInfo,
                                                                        Executor appExecutor,
                                                                        MetadataApplier applier) {
                                           assertThat(requestInfo.getMethodDescriptor())
                                                   .isEqualTo(TestServiceGrpc.getEmptyCallMethod());
                                           assertThat(requestInfo.getAuthority())
                                                   .isEqualTo("localhost:" + server.httpPort());
                                           assertThat(requestInfo.getSecurityLevel())
                                                   .isEqualTo(SecurityLevel.NONE);
                                           assertThat(appExecutor).isEqualTo(
                                                   CommonPools.blockingTaskExecutor());

                                           CommonPools.blockingTaskExecutor().schedule(() -> {
                                               final Metadata metadata = new Metadata();
                                               metadata.put(TestServiceImpl.EXTRA_HEADER_KEY, "token");
                                               applier.apply(metadata);
                                           }, 100, TimeUnit.MILLISECONDS);
                                       }

                                       @Override
                                       public void thisUsesUnstableApi() {
                                       }
                                   });

        assertThat(stub.emptyCall(EMPTY)).isNotNull();

        final HttpHeaders clientHeaders = CLIENT_HEADERS_CAPTURE.get();
        assertThat(clientHeaders.get(TestServiceImpl.EXTRA_HEADER_NAME)).isEqualTo("token");
    }
Must be at least {@link #unaryPayloadLength()}, plus some to account for encoding overhead.
grpc/src/test/java/com/linecorp/armeria/client/grpc/GrpcClientTest.java