@Nullable
    @Override
    public ServiceDescriptor findServiceDescriptor(Class<?> clientType) {
        final Class<?> stubClass = clientType.getEnclosingClass();
        if (stubClass == null) {
            return null;
        }

        try {
            final Method method = stubClass.getDeclaredMethod("SERVICE");
            return (ServiceDescriptor) method.invoke(null);
        } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
            throw new ServiceDescriptorResolutionException(getClass().getSimpleName(), Exceptions.peel(e));
        }
    }
A gRPC client stub factory for <a href="https://scalapb.github.io/">ScalaPB</a>.
grpc/src/main/java/com/linecorp/armeria/internal/client/grpc/ScalaPbGrpcClientStubFactory.java