@Override
    protected String buildHandle(final List<URIRegisterDTO> uriList, final SelectorDO selectorDO) {
        String handleAdd;
        List<WebSocketUpstream> addList = buildWebSocketUpstreamList(uriList);
        List<WebSocketUpstream> canAddList = new CopyOnWriteArrayList<>();
        List<WebSocketUpstream> existList = GsonUtils.getInstance().fromCurrentList(selectorDO.getHandle(), WebSocketUpstream.class);
        if (CollectionUtils.isEmpty(existList)) {
            handleAdd = GsonUtils.getInstance().toJson(addList);
            canAddList = addList;
        } else {
            List<WebSocketUpstream> diffList = addList.stream().filter(divideUpstream -> !existList.contains(divideUpstream)).collect(Collectors.toList());
            if (CollectionUtils.isNotEmpty(diffList)) {
                canAddList.addAll(diffList);
                existList.addAll(diffList);
            }
            handleAdd = GsonUtils.getInstance().toJson(existList);
        }
        doSubmit(selectorDO.getId(), canAddList);
        return handleAdd;
    }
@Test
    public void testBuildHandle() {
        URIRegisterDTO dto = new URIRegisterDTO();
        dto.setPort(8080);
        dto.setHost("host");
        dto.setProtocol("http");
        List<URIRegisterDTO> uriList = Collections.singletonList(dto);
        SelectorDO selectorDO = mock(SelectorDO.class);
        when(upstreamCheckService.checkAndSubmit(any(), any())).thenReturn(true);
        WebSocketUpstream.builder().host("localhost").protocol("http").upstreamUrl("host:8080").weight(50).warmup(10)
                .status(true).build();
        List result = GsonUtils.getInstance().fromJson(shenyuClientRegisterWebSocketService.buildHandle(uriList, selectorDO), List.class);
        LinkedTreeMap<String, Object> webSocketUpstreamResult = (LinkedTreeMap<String, Object>) result.get(0);
        assertEquals(webSocketUpstreamResult.get("host"), "localhost");
        assertEquals(webSocketUpstreamResult.get("url"), "host:8080");
        assertEquals(webSocketUpstreamResult.get("weight"), 50.0);
        assertEquals(webSocketUpstreamResult.get("warmup"), 600000.0);
        assertEquals(webSocketUpstreamResult.get("upstreamHost"), "localhost");
        assertEquals(webSocketUpstreamResult.get("status"), true);

        WebSocketUpstream webSocketUpstreamnew = WebSocketUpstream.builder().host("localhost").protocol("http").upstreamUrl("host:8090").weight(50).warmup(10)
                .status(true).build();
        SelectorDO selectorDO1 = new SelectorDO();
        selectorDO1.setHandle(GsonUtils.getGson().toJson(Collections.singletonList(webSocketUpstreamnew)));
        result = GsonUtils.getInstance().fromJson(shenyuClientRegisterWebSocketService.buildHandle(uriList, selectorDO1), List.class);
        webSocketUpstreamResult = (LinkedTreeMap<String, Object>) result.get(0);
        assertEquals(webSocketUpstreamResult.get("host"), "localhost");
        assertEquals(webSocketUpstreamResult.get("url"), "host:8090");
        assertEquals(webSocketUpstreamResult.get("weight"), 50.0);
        assertEquals(webSocketUpstreamResult.get("warmup"), 10.0);
        assertEquals(webSocketUpstreamResult.get("upstreamHost"), "localhost");
        assertEquals(webSocketUpstreamResult.get("status"), true);
        webSocketUpstreamResult = (LinkedTreeMap<String, Object>) result.get(1);
        assertEquals(webSocketUpstreamResult.get("host"), "localhost");
        assertEquals(webSocketUpstreamResult.get("url"), "host:8080");
        assertEquals(webSocketUpstreamResult.get("weight"), 50.0);
        assertEquals(webSocketUpstreamResult.get("warmup"), 600000.0);
        assertEquals(webSocketUpstreamResult.get("upstreamHost"), "localhost");
        assertEquals(webSocketUpstreamResult.get("status"), true);
    }