@Override
  public void doGet(
      final HttpServletRequest req, final HttpServletResponse resp)
      throws IOException {

    // By default requests are persistent. We don't want long-lived connections
    // on server side.
    resp.addHeader("Connection", "close");

    if (!isActive()) {
      // Report not SC_OK
      resp.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED,
          RESPONSE_NOT_ACTIVE);
      return;
    }
    resp.setStatus(HttpServletResponse.SC_OK);
    resp.getWriter().write(RESPONSE_ACTIVE);
    resp.getWriter().flush();
  }
@Test
  public void testFailsOnInactive() throws IOException {
    servlet = new IsActiveServlet() {
      @Override
      protected boolean isActive() {
        return false;
      }
    };

    doGet();
    verify(resp, atLeastOnce()).sendError(
        eq(HttpServletResponse.SC_METHOD_NOT_ALLOWED),
        eq(IsActiveServlet.RESPONSE_NOT_ACTIVE));
  }