package ibt.ortc.api;

import org.apache.commons.codec.binary.Base64;

/**
 * Class containing definition of proxy connection
 */
public class Proxy {
	private String host;
	private int port;
	private String proxyAuth;

	/**
	 * Creates an instance with proxy url and port defined
	 *  @param host Proxy host
	 * @param port Proxy port
	 * @param user
	 * @param pwd
	 */
	public Proxy(String host, int port, String user, String pwd){
		this.host = host;
		this.port = port;
		if (user != null && pwd != null) {
			proxyAuth = Base64.encodeBase64String((user + ":" + pwd).getBytes());
		}
	}
	
	/**
	 * Obtain defined proxy host
	 * 
	 * @return porxy host
	 */
	public String getHost(){
		return this.host;
	}
	/**
	 * Obtain defined proxy port
	 * 
	 * @return porxy port
	 */
	public int getPort(){
		return this.port;
	}

	public String getProxyAuth() {
		return proxyAuth;
	}
}

@@ -27,39 +27,21 @@
 ort 
-org.apache.commons.codec.binary
+ibt.ortc.util
 .Bas
@@ -256,16 +256,20 @@
 defined%0A
+%09 *%0A
 %09 *  @pa
@@ -322,34 +322,364 @@
 %0A%09 *
- @param user%0A%09 * @param pw
+/%0A%09public Proxy(String host, int port)%7B%0A%09%09this(host, port, null, null);%0A%09%7D%0A%09%0A%09/**%0A%09 * Creates proxy config using given host, port and optional credentials%0A%09 *%0A%09 * @param host%09proxy host%0A%09 * @param port%09proxy port%0A%09 * @param user%09proxy user or null if no authentication should be used%0A%09 * @param pwd%09proxy password or null if no authentication should be use
 d%0A%09 
@@ -853,20 +853,8 @@
 code
-Base64String
 ((us
@@ -885,26 +885,25 @@
 ());%0A%09%09%7D%0A%09%7D%0A
-%09
 %0A
+
 %09/**%0A%09 * Obt
@@ -1122,16 +1122,196 @@
 rt;%0A%09%7D%0A%0A
+%09/**%0A%09 * returns the encoded password hash according to basic authentication scheme %22user:password%22%0A%09 *%0A%09 * @return%09encoded password hash or null if no authentication is used%0A%09 */%0A
 %09public 

add constructor without credentials