+
+ HttpURLConnection connection = (HttpURLConnection) new URL("https://"
+ + getServerName().replaceFirst("^www.", "secure.") + "/login").openConnection();
+ authenticateClientCert(pk, ce, connection);
+ if (connection.getResponseCode() == 302) {
+ assertEquals("https://" + getServerName().replaceFirst("^www.", "secure.").replaceFirst(":443$", "") + "/",
+ connection.getHeaderField("Location").replaceFirst(":443$", ""));
+ return stripCookie(connection.getHeaderField("Set-Cookie"));
+ } else {
+ return null;
+ }
+ }
+
+ public void authenticateClientCert(final PrivateKey pk, final X509Certificate ce, HttpURLConnection connection)
+ throws NoSuchAlgorithmException, KeyManagementException {