public <T extends Instance> List<T> select(Selector selector, String consumerIp, List<T> providers) {
        if (Objects.isNull(selector)) {
            return providers;
        }
        SelectorContextBuilder selectorContextBuilder = contextBuilders.get(selector.getContextType());
        if (Objects.isNull(selectorContextBuilder)) {
            Loggers.SRV_LOG.info("[SelectorManager] cannot find the contextBuilder of type {}.", selector.getType());
            return providers;
        }
        try {
            Object context = selectorContextBuilder.build(consumerIp, providers);
            return (List<T>) selector.select(context);
        } catch (Exception e) {
            Loggers.SRV_LOG.warn("[SelectorManager] execute select failed, will return all providers.", e);
            return providers;
        }
    }
@Test
    void testSelect() throws NacosException {
        Selector selector = selectorManager.parseSelector("mock", "key=value");
        Instance instance = new Instance();
        instance.setIp("2.2.2.2");
        List<Instance> providers = Collections.singletonList(instance);
        
        List<Instance> instances0 = selectorManager.select(selector, "1.1.1.1", providers);
        assertEquals(1, instances0.size());
        assertEquals("2.2.2.2", instances0.get(0).getIp());
        
        // test json serial for Selector
        Serializer serializer0 = SerializeFactory.getSerializer("JSON");
        byte[] bytes = serializer0.serialize(selector);
        Selector jsonSelector = serializer0.deserialize(bytes, Selector.class);
        
        List<Instance> instances1 = selectorManager.select(jsonSelector, "1.1.1.1", providers);
        assertEquals(1, instances1.size());
        assertEquals("2.2.2.2", instances1.get(0).getIp());
        
        // test hessian serial for Selector
        Serializer serializer1 = SerializeFactory.getDefault();
        byte[] bytes1 = serializer1.serialize(selector);
        Selector hessianSelector = serializer1.deserialize(bytes1);
        
        List<Instance> instances2 = selectorManager.select(hessianSelector, "1.1.1.1", providers);
        assertEquals(1, instances2.size());
        assertEquals("2.2.2.2", instances2.get(0).getIp());
    }