I discovered what the problem is for at least some of the failures (if not
all). In some of the tests, attempts are made to contact a remote site through
a HttpURLConnection to validate a URL. If one is sitting behind an http proxy,
then system properties need to be set properly for it to work.. Furthermore,
if your proxy requires authentication (which mine does), then you further need
to modify the connection to add credentials. For example:
(one could set these at the VM as well, obviously)
public class Cas20ProxyHandlerTests extends TestCase {
private Cas20ProxyHandler handler;
protected void setUp() throws Exception {
this.handler = new Cas20ProxyHandler();
this.handler.setHttpClient(new HttpClient());
this.handler.setUniqueTicketIdGenerator(new
DefaultUniqueTicketIdGenerator());
Properties systemSettings = System.getProperties();
systemSettings.put("http.proxyHost", "yourhost.atyourplace.com");
systemSettings.put("http.proxyPort", "80");
System.setProperties(systemSettings);
}
and in the class that actually makes the connection (bleh):
public final class HttpClient implements Serializable {
// line 116
public boolean isValidEndPoint(final URL url) {
HttpURLConnection connection = null;
try {
connection = (HttpURLConnection) url.openConnection();
connection.setConnectTimeout(this.connectionTimeout);
connection.setReadTimeout(this.readTimeout);
String encoded = new String
(Base64.encodeBase64((new
String("youruserid:yourpass").getBytes())));
connection.setRequestProperty("Proxy-Authorization", "Basic " +
encoded);
connection.connect();
I'm not advocating this as the exact fix, merely passing information along.
One reasonable solution may be to modify the remote tests and let them read a
system prop to see whether they ought to test anything that requires a remote
connection (if it's set then they would autopass the tests that require remote
connections).
--- On Tue, 2/24/09, Marvin Addison <[email protected]> wrote:
From: Marvin Addison <[email protected]>
Subject: Re: [cas-user] Problem with tests when behind a proxy
To: [email protected]
Date: Tuesday, February 24, 2009, 12:00 PM
I noted this test points to https://www.ja-sig.org as a "good" URL.
Due to the Jasig Web site reoganization, that URL now sends you
ultimately to http://www.jasig.org/ after two 301 redirects. I wonder
if your errors are caused by your proxy's handling of redirects. You
might try a different HTTPS URL that is secured by a cert from a
common vendor (Verisign, Thawte) that does _not_ send redirects and
see if that succeeds.
M
--
You are currently subscribed to [email protected] as: [email protected]
To unsubscribe, change settings or access archives, see
http://www.ja-sig.org/wiki/display/JSG/cas-user
--
You are currently subscribed to [email protected] as:
[email protected]
To unsubscribe, change settings or access archives, see
http://www.ja-sig.org/wiki/display/JSG/cas-user