<commit_before>package de.uxnr.proxy;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.Executor;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

import com.sun.net.httpserver.HttpServer;

@SuppressWarnings("restriction")
public class Proxy implements Runnable {
	private final ProxyHandler handler;
	private final InetSocketAddress address;
	private final BlockingQueue<Runnable> queue;
	private final Executor executor;
	private final HttpServer server;

	private final int backlog = 10;
	private final int poolSize = 2;
	private final int maxPoolSize = 64;
	private final int keepAliveTime = 10;

	public Proxy(int port) throws IOException {
		this.handler = new ProxyHandler();
		this.address = new InetSocketAddress("localhost", port);
		this.queue = new SynchronousQueue<Runnable>();
		this.executor = new ThreadPoolExecutor(this.poolSize, this.maxPoolSize, this.keepAliveTime, TimeUnit.SECONDS, this.queue);
		this.server = HttpServer.create(this.address, this.backlog);
		this.server.createContext("/", this.handler);
		this.server.setExecutor(this.executor);
	}

	public void start() {
		this.server.start();
	}

	public void stop(int delay) {
		this.server.stop(delay);
	}

	public void stop() {
		this.stop(0);
	}

	public void addHostHandler(String host, HostHandler hostHandler) {
		this.handler.addHostHandler(host, hostHandler);
	}

	public void removeHostHandler(String host) {
		this.handler.removeHostHandler(host);
	}
<commit_msg>Added second constructor to make proxy listen on non-local socket<commit_after>package de.uxnr.proxy;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.Executor;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

import com.sun.net.httpserver.HttpServer;

@SuppressWarnings("restriction")
public class Proxy implements Runnable {
	private final ProxyHandler handler;
	private final InetSocketAddress address;
	private final BlockingQueue<Runnable> queue;
	private final Executor executor;
	private final HttpServer server;

	private final int backlog = 10;
	private final int poolSize = 2;
	private final int maxPoolSize = 64;
	private final int keepAliveTime = 10;

	public Proxy(InetSocketAddress address) throws IOException {
		this.address = address;
		this.handler = new ProxyHandler();
		this.queue = new SynchronousQueue<Runnable>();
		this.executor = new ThreadPoolExecutor(this.poolSize, this.maxPoolSize, this.keepAliveTime, TimeUnit.SECONDS, this.queue);
		this.server = HttpServer.create(this.address, this.backlog);
		this.server.createContext("/", this.handler);
		this.server.setExecutor(this.executor);
	}

	public Proxy(int port) throws IOException {
		this(new InetSocketAddress("localhost", port));
	}

	public void start() {
		this.server.start();
	}

	public void stop(int delay) {
		this.server.stop(delay);
	}

	public void stop() {
		this.stop(0);
	}

	public void addHostHandler(String host, HostHandler hostHandler) {
		this.handler.addHostHandler(host, hostHandler);
	}

	public void removeHostHandler(String host) {
		this.handler.removeHostHandler(host);
	}

{'fraction_non_alphanumeric': 0.10139341832196858, 'fraction_numerical': 0.004743551734361103, 'mean_word_length': 5.46360153256705, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6173942', 'n_tokens_mistral': 1072, 'n_tokens_neox': 1013, 'n_words': 251}