Flux<List<ServiceInstance>> doRouter(Flux<List<ServiceInstance>> allServers, PolarisRouterContext routerContext) {
		ServiceInstances serviceInstances = RouterUtils.transferServersToServiceInstances(allServers, instanceTransformer);

		List<ServiceInstance> filteredInstances = new ArrayList<>();
		if (serviceInstances.getInstances().size() > 0) {
			// filter instance by routers
			ProcessRoutersRequest processRoutersRequest = buildProcessRoutersRequest(serviceInstances, routerContext);

			// process request interceptors
			processRouterRequestInterceptors(processRoutersRequest, routerContext);

			// process router chain
			ProcessRoutersResponse processRoutersResponse = routerAPI.processRouters(processRoutersRequest);

			// process response interceptors
			processRouterResponseInterceptors(routerContext, processRoutersResponse);

			// transfer polaris server to ServiceInstance
			ServiceInstances filteredServiceInstances = processRoutersResponse.getServiceInstances();
			for (Instance instance : filteredServiceInstances.getInstances()) {
				filteredInstances.add(new PolarisServiceInstance(instance));
			}
		}
		return Flux.fromIterable(Collections.singletonList(filteredInstances));
	}
@Test
	public void testRouter() {
		when(polarisRuleBasedRouterProperties.isEnabled()).thenReturn(true);

		try (MockedStatic<ApplicationContextAwareUtils> mockedApplicationContextAwareUtils = Mockito.mockStatic(ApplicationContextAwareUtils.class)) {
			mockedApplicationContextAwareUtils.when(() -> ApplicationContextAwareUtils.getProperties(anyString()))
					.thenReturn(testCallerService);

			setTransitiveMetadata();

			PolarisRouterServiceInstanceListSupplier polarisSupplier = new PolarisRouterServiceInstanceListSupplier(
					delegate, routerAPI, requestInterceptors, Collections.singletonList(new TestRouterResponseInterceptor()), new PolarisInstanceTransformer());

			ProcessRoutersResponse assembleResponse = assembleProcessRoutersResponse();
			when(routerAPI.processRouters(any())).thenReturn(assembleResponse);

			Flux<List<ServiceInstance>> servers = polarisSupplier.doRouter(assembleServers(), assembleRouterContext());

			assertThat(servers.toStream().mapToLong(List::size).sum()).isEqualTo(assembleResponse.getServiceInstances()
					.getInstances().size());
		}
	}