@Override
    @TpsControl(pointName = "RemoteNamingServiceQuery", name = "RemoteNamingServiceQuery")
    @Secured(action = ActionTypes.READ)
    @ExtractorManager.Extractor(rpcExtractor = ServiceQueryRequestParamExtractor.class)
    public QueryServiceResponse handle(ServiceQueryRequest request, RequestMeta meta) throws NacosException {
        String namespaceId = request.getNamespace();
        String groupName = request.getGroupName();
        String serviceName = request.getServiceName();
        Service service = Service.newService(namespaceId, groupName, serviceName);
        String cluster = null == request.getCluster() ? "" : request.getCluster();
        boolean healthyOnly = request.isHealthyOnly();
        ServiceInfo result = serviceStorage.getData(service);
        ServiceMetadata serviceMetadata = metadataManager.getServiceMetadata(service).orElse(null);
        result = ServiceUtil.selectInstancesWithHealthyProtection(result, serviceMetadata, cluster, healthyOnly, true,
                NamingRequestUtil.getSourceIpForGrpcRequest(meta));
        return QueryServiceResponse.buildSuccessResponse(result);
    }
@Test
    void testHandle() throws NacosException {
        Instance instance = new Instance();
        instance.setIp("1.1.1.1");
        List<Instance> instances = Arrays.asList(instance);
        ServiceInfo serviceInfo = new ServiceInfo();
        serviceInfo.setGroupName("A");
        serviceInfo.setGroupName("B");
        serviceInfo.setName("C");
        serviceInfo.setHosts(instances);
        Mockito.when(serviceStorage.getData(Mockito.any())).thenReturn(serviceInfo);
        
        ServiceMetadata serviceMetadata = new ServiceMetadata();
        Mockito.when(metadataManager.getServiceMetadata(Mockito.any())).thenReturn(Optional.of(serviceMetadata));
        
        ServiceQueryRequest serviceQueryRequest = new ServiceQueryRequest();
        serviceQueryRequest.setNamespace("A");
        serviceQueryRequest.setGroupName("B");
        serviceQueryRequest.setServiceName("C");
        serviceQueryRequest.setHealthyOnly(false);
        QueryServiceResponse queryServiceResponse = serviceQueryRequestHandler.handle(serviceQueryRequest, new RequestMeta());
        
        assertEquals("C", queryServiceResponse.getServiceInfo().getName());
    }