Code example for HttpURLConnection

Methods: getErrorStreamgetResponseCode

	public void set(boolean b) {this.b=b;}
	public boolean get() {return b;}
	public static byte[] executeRequest(HttpURLConnection conn, HttpStatus expectedRc, String failureReason) throws Exception {
		int rc = conn.getResponseCode();
		if (expectedRc.value()==rc) {
			byte[] respBody = (CrowdAuthUtil.readInputStream((InputStream)conn.getContent())).getBytes();
			return respBody;
		} else { 
			byte[] respBody = (CrowdAuthUtil.readInputStream((InputStream)conn.getErrorStream())).getBytes();
			throw new AuthenticationException(rc, failureReason, new Exception(new String(respBody)));
	// this is meant to recreate the problem described in PLFM-292 
	public void testMultipleLogins() throws Exception {