@Nullable
    @Override
    public ServiceDescriptor findServiceDescriptor(Class<?> clientType) {
        final String clientTypeName = clientType.getName();

        if (clientTypeName.endsWith("CoroutineStub")) {
            return null;
        }

        if (!clientTypeName.endsWith("Stub")) {
            return null;
        }

        final Class<?> enclosingClass = clientType.getEnclosingClass();
        if (enclosingClass == null) {
            return null;
        }
        try {
            final Method getServiceDescriptorMethod = enclosingClass.getDeclaredMethod("getServiceDescriptor");
            return (ServiceDescriptor) getServiceDescriptorMethod.invoke(null);
        } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
            throw new ServiceDescriptorResolutionException(getClass().getSimpleName(), Exceptions.peel(e));
        }
    }
A gRPC client stub factory for <a href="https://github.com/grpc/grpc-java">gRPC-Java</a>.
grpc/src/main/java/com/linecorp/armeria/internal/client/grpc/JavaGrpcClientStubFactory.java