@Override
    public void handle(HttpServletRequest request, HttpServletResponse response, String resourceName, BlockException ex)
            throws Exception {
        // Return 429 (Too Many Requests) by default.
        response.setStatus(429);

        PrintWriter out = response.getWriter();
        out.print("Blocked by Sentinel (flow limiting)");
        out.flush();
        out.close();
    }
@Test
    public void handle_writeBlockPage() throws Exception {
        DefaultBlockExceptionHandler h = new DefaultBlockExceptionHandler();
        MockHttpServletRequest req = new MockHttpServletRequest("GET", "/a/b/c");
        req.setQueryString("a=1&b=2");
        MockHttpServletResponse resp = new MockHttpServletResponse();
        String resourceName = "/a/b/c";
        BlockException ex = new FlowException("msg");
        h.handle(req, resp, resourceName, ex);
        assertEquals(429, resp.getStatus());
    }