private String assembleAuthority(
		String host,
		int port,
		String userInfo,
		String authority
	) {
		if (authority != null) {
			return authority;
		}
		
		StringBuffer buf = new StringBuffer();
		
		// UserInfo
		if (userInfo != null) {
			buf.append(userInfo);
			buf.append(USERINFO_DELIM);
		}
		
		// Host. Note if the host is null then this URL will be malformed
		if (host != null) {
			buf.append(host);
		}
		
		// Port
		if (port > 0) {
			buf.append(PORT_DELIM);
			buf.append(port);
		}
		
		return buf.toString();
	}