<commit_before>import java.io.*;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;

/*Created by aidan on 10/26/14.
 */
public class ProxyThread implements Runnable{

    private Socket clientSocket;

    ProxyThread(Socket givenSocket){
     this.clientSocket = givenSocket;
    }

    /**
     * Trying out a pretty linear programming style.
     * Complexity: 1
     */
    @Override
    public void run(){
        try {
            while (true) {
                byte[] givenData = readFromSocket(clientSocket);
                givenData = HeaderEditor.convertConnection(givenData);
                log(givenData);
                Socket remoteRequest = forwardRequest(givenData);
                byte[] response = readFromSocket(remoteRequest);
                response = HeaderEditor.convertConnection(response);
                close(remoteRequest);
                log(response);
                writeToSocket(clientSocket, response);
                close(clientSocket);
            }
        } catch (Exception e) {
            System.err.println("An uncaught error was encountered!");
            e.printStackTrace();<commit_msg>fixed infinite loop<commit_after>import java.io.*;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;

/*Created by aidan on 10/26/14.
 */
public class ProxyThread implements Runnable{

    private Socket clientSocket;

    public ProxyThread(Socket givenSocket){
     this.clientSocket = givenSocket;
    }

    /**
     * Trying out a pretty linear programming style.
     * Complexity: 1
     */
    @Override
    public void run(){
        try {
            System.out.println("Thread instantiated.");
            byte[] givenData = readFromSocket(clientSocket);
            givenData = HeaderEditor.convertConnection(givenData);
            log(givenData);
            Socket remoteRequest = forwardRequest(givenData);
            byte[] response = readFromSocket(remoteRequest);
            response = HeaderEditor.convertConnection(response);
            close(remoteRequest);
            log(response);
            writeToSocket(clientSocket, response);
            close(clientSocket);
            System.out.println("Serviced request.");
        } catch (Exception e) {
            System.err.println("An uncaught error was encountered!");
            e.printStackTrace();
{'fraction_non_alphanumeric': 0.09488139825218476, 'fraction_numerical': 0.005826050769870994, 'mean_word_length': 2.293150684931507, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1322341', 'n_tokens_mistral': 615, 'n_tokens_neox': 574, 'n_words': 142}