@Override
    public Object handle(String targetService, List<Object> invokers, Object invocation, Map<String, String> queryMap,
            String serviceInterface) {
        if (!shouldHandle(invokers)) {
            return invokers;
        }
        List<Object> targetInvokers;
        if (routerConfig.isUseRequestRouter()) {
            targetInvokers = getTargetInvokersByRequest(targetService, invokers, invocation);
        } else {
            targetInvokers = getTargetInvokersByRules(invokers, invocation, queryMap, targetService, serviceInterface);
        }
        return super.handle(targetService, targetInvokers, invocation, queryMap, serviceInterface);
    }
@Test
    public void testGetTargetInvokersByRequestWithMismatch() {
        config.setUseRequestRouter(true);
        config.setRequestTags(Arrays.asList("foo", "bar", "version"));
        List<Object> invokers = new ArrayList<>();
        ApacheInvoker<Object> invoker1 = new ApacheInvoker<>("1.0.0",
                Collections.singletonMap(RouterConstant.PARAMETERS_KEY_PREFIX + "foo", "bar1"));
        invokers.add(invoker1);
        ApacheInvoker<Object> invoker2 = new ApacheInvoker<>("1.0.1",
                Collections.singletonMap(RouterConstant.PARAMETERS_KEY_PREFIX + "bar", "bar2"));
        invokers.add(invoker2);
        ApacheInvoker<Object> invoker3 = new ApacheInvoker<>("1.0.1");
        invokers.add(invoker3);
        Invocation invocation = new ApacheInvocation();
        Map<String, String> queryMap = new HashMap<>();
        queryMap.put("side", "consumer");
        queryMap.put("group", "fooGroup");
        queryMap.put("version", "0.0.1");
        queryMap.put("interface", "io.sermant.foo.FooTest");
        DubboCache.INSTANCE.putApplication("io.sermant.foo.FooTest", "foo");

        // When not matching the bar: bar1 instance, match instances without bar labels
        invocation.setAttachment("bar", "bar1");
        List<Object> targetInvokers = (List<Object>) flowRouteHandler.handle(
                DubboCache.INSTANCE.getApplication("io.sermant.foo.FooTest")
                , invokers, invocation, queryMap, "io.sermant.foo.FooTest");
        Assert.assertEquals(2, targetInvokers.size());
        Assert.assertFalse(targetInvokers.contains(invoker2));

        // When not matching instance bar1, prioritize matching instances without bar labels.
        // If there are no instances without bar labels, return an empty list
        List<Object> sameInvokers = new ArrayList<>();
        ApacheInvoker<Object> sameInvoker1 = new ApacheInvoker<>("1.0.0",
                Collections.singletonMap(RouterConstant.PARAMETERS_KEY_PREFIX + "bar", "bar3"));
        sameInvokers.add(sameInvoker1);
        ApacheInvoker<Object> sameInvoker2 = new ApacheInvoker<>("1.0.1",
                Collections.singletonMap(RouterConstant.PARAMETERS_KEY_PREFIX + "bar", "bar2"));
        sameInvokers.add(sameInvoker2);
        invocation.getObjectAttachments().clear();
        invocation.setAttachment("bar", "bar1");
        targetInvokers = (List<Object>) flowRouteHandler.handle(DubboCache.INSTANCE.getApplication("io.sermant" +
                        ".foo.FooTest")
                , sameInvokers, invocation, queryMap, "io.sermant.foo.FooTest");
        Assert.assertEquals(0, targetInvokers.size());

        // When the version does not match the 1.0.3 instance, return all instances of the version
        invocation.getObjectAttachments().clear();
        invocation.setAttachment("version", "1.0.3");
        targetInvokers = (List<Object>) flowRouteHandler.handle(DubboCache.INSTANCE.getApplication("io.sermant" +
                        ".foo.FooTest")
                , invokers, invocation, queryMap, "io.sermant.foo.FooTest");
        Assert.assertEquals(3, targetInvokers.size());

        // Match unlabeled instances when no attachment is passed in
        invocation.getObjectAttachments().clear();
        targetInvokers = (List<Object>) flowRouteHandler.handle(DubboCache.INSTANCE.getApplication("io.sermant" +
                        ".foo.FooTest")
                , invokers, invocation, queryMap, "io.sermant.foo.FooTest");
        Assert.assertEquals(1, targetInvokers.size());
        Assert.assertEquals(invoker3, targetInvokers.get(0));

        // When no attachment is passed in, priority is given to matching unlabeled instances. When there are no
        // unlabeled instances, all instances are returned
        invocation.getObjectAttachments().clear();
        targetInvokers = (List<Object>) flowRouteHandler.handle(DubboCache.INSTANCE.getApplication("io.sermant" +
                        ".foo.FooTest")
                , sameInvokers, invocation, queryMap, "io.sermant.foo.FooTest");
        Assert.assertEquals(sameInvokers, targetInvokers);
    }