@Override
        public void unaryCall(SimpleRequest request, StreamObserver<SimpleResponse> responseObserver) {
            final SimpleResponse response = SimpleResponse.newBuilder()
                                                          .setPayload(request.getPayload())
                                                          .build();
            final String payload = request.getPayload().getBody().toStringUtf8();
            if ("peanuts".equals(payload)) {
                responseObserver.onError(
                        new StatusException(Status.INTERNAL.withDescription("we don't sell peanuts"))
                );
            } else if ("ice cream".equals(payload)) {
                responseObserver.onNext(response); // Note: we error after the response, so trailers
                responseObserver.onError(
                        new StatusException(Status.INTERNAL.withDescription("no more ice cream"))
                );
            } else {
                responseObserver.onNext(response);
                responseObserver.onCompleted();
            }
        }
This shows we can handle status that happens in trailers.
grpc/src/test/java/com/linecorp/armeria/client/grpc/protocol/UnaryGrpcClientTest.java