// Path: src/main/java/com/yammer/httptunnel/util/DefaultTunnelIdGenerator.java
// public class DefaultTunnelIdGenerator implements TunnelIdGenerator {
// 
// 	private final SecureRandom generator;
// 
// 	/**
// 	 * Constructs a new instance using a new {@link SecureRandom} instance.
// 	 */
// 	public DefaultTunnelIdGenerator() {
// 		this(new SecureRandom());
// 	}
// 
// 	/**
// 	 * Constructs a new instance using the provided {@link SecureRandom} instance.
// 	 */
// 	public DefaultTunnelIdGenerator(SecureRandom generator) {
// 		this.generator = generator;
// 	}
// 
// 	@Override
// 	public synchronized String generateId() {
// 		// synchronized to ensure that this code is thread safe. The Sun
// 		// standard implementations seem to be synchronized or lock free
// 		// but are not documented as guaranteeing this
// 		return Integer.toHexString(generator.nextInt());
// 	}
// }
// 
// Path: src/main/java/com/yammer/httptunnel/util/TunnelIdGenerator.java
// public interface TunnelIdGenerator {
// 
// 	/**
// 	 * Generates the next tunnel ID to be used, which must be unique (i.e.
// 	 * ensure with high probability that it will not clash with an existing
// 	 * tunnel ID). This method must be thread safe, and preferably lock free.
// 	 */
// 	public String generateId();
// }


import java.util.Map;
import java.util.Map.Entry;
import org.jboss.netty.buffer.ChannelBufferFactory;
import org.jboss.netty.channel.ChannelPipelineFactory;
import org.jboss.netty.channel.socket.ServerSocketChannel;
import org.jboss.netty.channel.socket.ServerSocketChannelConfig;
import com.yammer.httptunnel.util.DefaultTunnelIdGenerator;
import com.yammer.httptunnel.util.TunnelIdGenerator;
	public void setUserAgent(String userAgent) {
		this.userAgent = userAgent;
	}

	public TunnelIdGenerator getTunnelIdGenerator() {
		return tunnelIdGenerator;
	}

	public void setTunnelIdGenerator(TunnelIdGenerator tunnelIdGenerator) {
		this.tunnelIdGenerator = tunnelIdGenerator;
	}

	@Override
	public void setPerformancePreferences(int connectionTime, int latency, int bandwidth) {
		this.getWrappedConfig().setPerformancePreferences(connectionTime, latency, bandwidth);
	}

	@Override
	public boolean setOption(String key, Object value) {
		if (PIPELINE_FACTORY_OPTION.equalsIgnoreCase(key)) {
			this.setPipelineFactory((ChannelPipelineFactory) value);
			return true;
		}

		if (TUNNEL_ID_GENERATOR_OPTION.equalsIgnoreCase(key)) {
			this.setTunnelIdGenerator((TunnelIdGenerator) value);
			return true;
		}

		if (USER_AGENT_OPTION.equalsIgnoreCase(key)) {
// Path: src/main/java/com/yammer/httptunnel/util/DefaultTunnelIdGenerator.java
// public class DefaultTunnelIdGenerator implements TunnelIdGenerator {
// 
// 	private final SecureRandom generator;
// 
// 	/**
// 	 * Constructs a new instance using a new {@link SecureRandom} instance.
// 	 */
// 	public DefaultTunnelIdGenerator() {
// 		this(new SecureRandom());
// 	}
// 
// 	/**
// 	 * Constructs a new instance using the provided {@link SecureRandom} instance.
// 	 */
// 	public DefaultTunnelIdGenerator(SecureRandom generator) {
// 		this.generator = generator;
// 	}
// 
// 	@Override
// 	public synchronized String generateId() {
// 		// synchronized to ensure that this code is thread safe. The Sun
// 		// standard implementations seem to be synchronized or lock free
// 		// but are not documented as guaranteeing this
// 		return Integer.toHexString(generator.nextInt());
// 	}
// }
// 
// Path: src/main/java/com/yammer/httptunnel/util/TunnelIdGenerator.java
// public interface TunnelIdGenerator {
// 
// 	/**
// 	 * Generates the next tunnel ID to be used, which must be unique (i.e.
// 	 * ensure with high probability that it will not clash with an existing
// 	 * tunnel ID). This method must be thread safe, and preferably lock free.
// 	 */
// 	public String generateId();
// }


// Path: src/main/java/com/yammer/httptunnel/server/HttpTunnelServerChannelConfig.java
import java.util.Map;
import java.util.Map.Entry;
import org.jboss.netty.buffer.ChannelBufferFactory;
import org.jboss.netty.channel.ChannelPipelineFactory;
import org.jboss.netty.channel.socket.ServerSocketChannel;
import org.jboss.netty.channel.socket.ServerSocketChannelConfig;
import com.yammer.httptunnel.util.DefaultTunnelIdGenerator;
import com.yammer.httptunnel.util.TunnelIdGenerator;

	public void setUserAgent(String userAgent) {
		this.userAgent = userAgent;
	}

	public TunnelIdGenerator getTunnelIdGenerator() {
		return tunnelIdGenerator;
	}

	public void setTunnelIdGenerator(TunnelIdGenerator tunnelIdGenerator) {
		this.tunnelIdGenerator = tunnelIdGenerator;
	}

	@Override
	public void setPerformancePreferences(int connectionTime, int latency, int bandwidth) {
		this.getWrappedConfig().setPerformancePreferences(connectionTime, latency, bandwidth);
	}

	@Override
	public boolean setOption(String key, Object value) {
		if (PIPELINE_FACTORY_OPTION.equalsIgnoreCase(key)) {
			this.setPipelineFactory((ChannelPipelineFactory) value);
			return true;
		}

		if (TUNNEL_ID_GENERATOR_OPTION.equalsIgnoreCase(key)) {
			this.setTunnelIdGenerator((TunnelIdGenerator) value);
			return true;
		}

		if (USER_AGENT_OPTION.equalsIgnoreCase(key)) {
			this.setUserAgent((String) value);