@Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
        if (GraceContext.INSTANCE.getStartWarmUpTime() == 0) {
            GraceContext.INSTANCE.setStartWarmUpTime(System.currentTimeMillis());
        }
        addGraceAddress(request);
        final GraceShutDownManager graceShutDownManager = GraceContext.INSTANCE.getGraceShutDownManager();
        graceShutDownManager.increaseRequestCount();
        if (graceShutDownManager.isShutDown() && graceConfig.isEnableGraceShutdown()) {
            // It has been marked as closed, and the number of incoming requests has been counted
            final ClientInfo clientInfo = RegisterContext.INSTANCE.getClientInfo();
            response.addHeader(GraceConstants.MARK_SHUTDOWN_SERVICE_ENDPOINT,
                    buildEndpoint(clientInfo.getIp(), clientInfo.getPort()));
            response.addHeader(GraceConstants.MARK_SHUTDOWN_SERVICE_ENDPOINT,
                    buildEndpoint(clientInfo.getHost(), clientInfo.getPort()));
            response.addHeader(GraceConstants.MARK_SHUTDOWN_SERVICE_NAME, clientInfo.getServiceName());
        }
        return true;
    }
@Test
    public void preHandle() {
        GraceContext.INSTANCE.getGraceShutDownManager().setShutDown(true);
        interceptor.preHandle(request, response, new Object());
        Assert.assertTrue(GraceContext.INSTANCE.getStartWarmUpTime() > 0);
        Assert.assertTrue(addresses.contains(testAddress));
        Assert.assertTrue(GraceContext.INSTANCE.getGraceShutDownManager().getRequestCount() > 0);
        Mockito.verify(response, Mockito.atLeastOnce()).addHeader(Mockito.anyString(), Mockito.anyString());
        GraceContext.INSTANCE.getGraceShutDownManager().setShutDown(false);
        GraceContext.INSTANCE.setStartWarmUpTime(0);
        GraceContext.INSTANCE.getGraceShutDownManager().decreaseRequestCount();
    }