<commit_before>package nl.mvdr.tinustris.gui;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.Random;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

import javafx.application.Application;
import javafx.stage.Stage;
import lombok.extern.slf4j.Slf4j;
import nl.mvdr.tinustris.configuration.Behavior;
import nl.mvdr.tinustris.configuration.Configuration;
import nl.mvdr.tinustris.configuration.ConfigurationImpl;
import nl.mvdr.tinustris.configuration.LocalPlayerConfiguration;
import nl.mvdr.tinustris.configuration.NetcodeConfiguration;
import nl.mvdr.tinustris.configuration.RemoteConfiguration;
import nl.mvdr.tinustris.logging.Logging;

/**
 * Main class, whose main method starts Tinustris with a netcode configuration.
 * 
 * This class relies on JInput's native libraries. These are not available by default. If you want to run this
 * class, make sure that the java.library.path system property contains target/natives in this project directory.
 * 
 * In Eclipse, you can do this by opening the Run Configuration, opening the arguments tab and pasting the following
 * into the "VM Arguments" text area:
 * 
 * <pre>
 * -Djava.library.path=${project_loc}/target/natives
 * </pre>
 * 
 * @author <NAME>
 */
@Slf4j
public class TinustrisNetcodeTestContext extends Application {
    /** Port number. */
    private static final int PORT = 8080;
    
    /** Tinustris instances. */
    private final List<Tinustris> gameInstances;
    
    /** Socket. */
    private final List<Socket> sockets;
    
    /** Constructor. */
    public TinustrisNetcodeTestContext() {
        super();
        
        this.gameInstances = Arrays.asList(new Tinustris(), new Tinustris());
        
        try {
            Future<Socket> serverSocketFuture = Executors.newSingleThreadExecutor().submit(() -> new ServerSocket(PORT).accept());
            Socket clientSocket = new Socket("localhost", PORT);
            
            this.sockets = Arrays.asList(clientSocket, serverSocketFuture.get());
        } catch (InterruptedException | ExecutionException e) {
            throw new IllegalStateException("Unable to open server socket.", e);
        } catch (IOException e) {
            throw new IllegalStateException("Unable to open client socket.", e);<commit_msg>Using a less common port for testing.<commit_after>package nl.mvdr.tinustris.gui;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.Random;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

import javafx.application.Application;
import javafx.stage.Stage;
import lombok.extern.slf4j.Slf4j;
import nl.mvdr.tinustris.configuration.Behavior;
import nl.mvdr.tinustris.configuration.Configuration;
import nl.mvdr.tinustris.configuration.ConfigurationImpl;
import nl.mvdr.tinustris.configuration.LocalPlayerConfiguration;
import nl.mvdr.tinustris.configuration.NetcodeConfiguration;
import nl.mvdr.tinustris.configuration.RemoteConfiguration;
import nl.mvdr.tinustris.logging.Logging;

/**
 * Main class, whose main method starts Tinustris with a netcode configuration.
 * 
 * This class relies on JInput's native libraries. These are not available by default. If you want to run this
 * class, make sure that the java.library.path system property contains target/natives in this project directory.
 * 
 * In Eclipse, you can do this by opening the Run Configuration, opening the arguments tab and pasting the following
 * into the "VM Arguments" text area:
 * 
 * <pre>
 * -Djava.library.path=${project_loc}/target/natives
 * </pre>
 * 
 * @author <NAME>
 */
@Slf4j
public class TinustrisNetcodeTestContext extends Application {
    /** Port number. */
    private static final int PORT = 8082;
    
    /** Tinustris instances. */
    private final List<Tinustris> gameInstances;
    
    /** Socket. */
    private final List<Socket> sockets;
    
    /** Constructor. */
    public TinustrisNetcodeTestContext() {
        super();
        
        this.gameInstances = Arrays.asList(new Tinustris(), new Tinustris());
        
        try {
            Future<Socket> serverSocketFuture = Executors.newSingleThreadExecutor().submit(() -> new ServerSocket(PORT).accept());
            Socket clientSocket = new Socket("localhost", PORT);
            
            this.sockets = Arrays.asList(clientSocket, serverSocketFuture.get());
        } catch (InterruptedException | ExecutionException e) {
            throw new IllegalStateException("Unable to open server socket.", e);
        } catch (IOException e) {
            throw new IllegalStateException("Unable to open client socket.", e);
{'fraction_non_alphanumeric': 0.09922330097087378, 'fraction_numerical': 0.0027184466019417475, 'mean_word_length': 3.7960893854748603, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 17, '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': '6205685', 'n_tokens_mistral': 1459, 'n_tokens_neox': 1424, 'n_words': 391}