GetMethod indexGet = new GetMethod(baseURLNoAuth+"form-auth/unsecure_form.html");
int responseCode = httpConn.executeMethod(indexGet);
assertTrue("Get OK", responseCode == HttpURLConnection.HTTP_OK);
// Submit the form to /restricted/SecuredPostServlet
PostMethod servletPost = new PostMethod(baseURLNoAuth+"form-auth/restricted/SecuredPostServlet");
servletPost.addParameter("checkParam", "123456");
responseCode = httpConn.executeMethod(servletPost);
String body = servletPost.getResponseBodyAsString();
assertTrue("Get OK", responseCode == HttpURLConnection.HTTP_OK);
assertTrue("Redirected to login page", body.indexOf("j_security_check") > 0 );