<commit_before>package com.github.lutzblox;

import junit.framework.TestCase;
import junit.framework.TestSuite;

import com.github.lutzblox.exceptions.reporters.ErrorReporterFactory;
import com.github.lutzblox.listeners.ClientListener;
import com.github.lutzblox.listeners.ServerListener;
import com.github.lutzblox.packets.Packet;
import com.github.lutzblox.sockets.Connection;


public class EmptyPacketTest extends TestCase {

    private boolean finished = false, errored = false;
    private String errorMessage = "";

    public EmptyPacketTest(String name) {

        super(name);
    }

    public static TestSuite suite() {

        return new TestSuite(EmptyPacketTest.class);
    }

    public void testEmptyPacket() {

        final Server server = new Server(12345, "EmptyPacketTest");
        server.addErrorReporter(ErrorReporterFactory.newInstance());
        server.addNetworkListener(new ServerListener() {

            @Override
            public void onReceive(Connection connection, Packet packet) {

            }

            @Override
            public Packet onConnect(Connection c, Packet data) {

                System.out.println("Server: Connection received from IP "
                        + c.getIp());

                return data;
            }

            @Override
            public void onTimeout(Connection connection) {

            }

            @Override
            public void onClientFailure(Connection c) {

            }
        });

        final Client client = new Client("0.0.0.0", 12345);
        client.addErrorReporter(ErrorReporterFactory.newInstance());
        client.addNetworkListener(new ClientListener() {
<commit_msg>Fixed EmptyPacketTest's "empty" packet<commit_after>package com.github.lutzblox;

import junit.framework.TestCase;
import junit.framework.TestSuite;

import com.github.lutzblox.exceptions.reporters.ErrorReporterFactory;
import com.github.lutzblox.listeners.ClientListener;
import com.github.lutzblox.listeners.ServerListener;
import com.github.lutzblox.packets.Packet;
import com.github.lutzblox.sockets.Connection;


public class EmptyPacketTest extends TestCase {

    private boolean finished = false, errored = false;
    private String errorMessage = "";

    public EmptyPacketTest(String name) {

        super(name);
    }

    public static TestSuite suite() {

        return new TestSuite(EmptyPacketTest.class);
    }

    public void testEmptyPacket() {

        final Server server = new Server(12345, "EmptyPacketTest");
        server.addErrorReporter(ErrorReporterFactory.newInstance());
        server.addNetworkListener(new ServerListener() {

            @Override
            public void onReceive(Connection connection, Packet packet) {

            }

            @Override
            public Packet onConnect(Connection c, Packet data) {

                System.out.println("Server: Connection received from IP "
                        + c.getIp());
                data.clearData();

                return data;
            }

            @Override
            public void onTimeout(Connection connection) {

            }

            @Override
            public void onClientFailure(Connection c) {

            }
        });

        final Client client = new Client("0.0.0.0", 12345);
        client.addErrorReporter(ErrorReporterFactory.newInstance());
        client.addNetworkListener(new ClientListener() {

{'fraction_non_alphanumeric': 0.08608112051356871, 'fraction_numerical': 0.008170411438576015, 'mean_word_length': 2.4908350305498983, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '3397878', 'n_tokens_mistral': 933, 'n_tokens_neox': 855, 'n_words': 192}