@Override
    public void run() {
        connect();
        if (input != null && output != null && connectionSocket != null) {
            System.out.println("Starting game");
            startGame();
        }
        try {
            if (input != null) {
                System.out.println("Closing input");
                input.close();
            }

            if (output != null) {
                System.out.println("Closing output");
                output.close();
            }

            if (connectionSocket != null) {
                System.out.println("Closing connection socket");
                connectionSocket.close();
            }
        }
        catch (IOException e) {
            System.err.println("Exception closing resources. Message: " + e.getMessage());
            e.printStackTrace();
            System.exit(0);
        }
        System.exit(0);
    }