static Node selectNodeByRequesterAndStrategy(/*@NonNull*/ FlowRule rule, Context context, DefaultNode node) {
        // The limit app should not be empty.
        String limitApp = rule.getLimitApp();
        int strategy = rule.getStrategy();
        String origin = context.getOrigin();

        if (limitApp.equals(origin) && filterOrigin(origin)) {
            if (strategy == RuleConstant.STRATEGY_DIRECT) {
                // Matches limit origin, return origin statistic node.
                return context.getOriginNode();
            }

            return selectReferenceNode(rule, context, node);
        } else if (RuleConstant.LIMIT_APP_DEFAULT.equals(limitApp)) {
            if (strategy == RuleConstant.STRATEGY_DIRECT) {
                // Return the cluster node.
                return node.getClusterNode();
            }

            return selectReferenceNode(rule, context, node);
        } else if (RuleConstant.LIMIT_APP_OTHER.equals(limitApp)
            && FlowRuleManager.isOtherOrigin(origin, rule.getResource())) {
            if (strategy == RuleConstant.STRATEGY_DIRECT) {
                return context.getOriginNode();
            }

            return selectReferenceNode(rule, context, node);
        }

        return null;
    }
@Test
    public void testOtherOriginFlowSelectNode() {
        String originA = "appA";
        String originB = "appB";

        DefaultNode node = mock(DefaultNode.class);
        DefaultNode originNode = mock(DefaultNode.class);
        ClusterNode cn = mock(ClusterNode.class);
        when(node.getClusterNode()).thenReturn(cn);
        Context context = mock(Context.class);
        when(context.getOriginNode()).thenReturn(originNode);

        FlowRule ruleA = new FlowRule("testOtherOriginFlowSelectNode").setCount(1);
        ruleA.setLimitApp(originA);
        FlowRule ruleB = new FlowRule("testOtherOriginFlowSelectNode").setCount(2);
        ruleB.setLimitApp(RuleConstant.LIMIT_APP_OTHER);
        FlowRuleManager.loadRules(Arrays.asList(ruleA, ruleB));

        // Origin matches other, return the origin node.
        when(context.getOrigin()).thenReturn(originB);
        assertEquals(originNode, FlowRuleChecker.selectNodeByRequesterAndStrategy(ruleB, context, node));

        // Origin matches limitApp of an existing rule, so no nodes are selected.
        when(context.getOrigin()).thenReturn(originA);
        assertNull(FlowRuleChecker.selectNodeByRequesterAndStrategy(ruleB, context, node));
    }