@Override
    protected void connect() {
        Thread connectThread = new Thread(new Runnable() {
            @Override
            public void run() {
                String ip = JOptionPane.showInputDialog(mainRenderFrame, "Enter IP address for server:", "Communication.GameClient", JOptionPane.QUESTION_MESSAGE);

                if (ip == null || ip.isEmpty()) {
                    try {
                        ip = InetAddress.getLocalHost().getHostAddress();
                    } catch (UnknownHostException e) {
                        e.printStackTrace();
                        System.exit(1);
                    }
                }

                final String immutableIP = ip;
                try {
                    if (stopping) {return;}
                    Socket clientSocket = new Socket(immutableIP, Main.Main.PORT);
                    input = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
                    output = new PrintWriter(clientSocket.getOutputStream(), true);
                    if (stopping) {return;}
                    // Exchange names for 'waiting for move from ' text
                    output.println(name);
                    opponentName = input.readLine();
                    connectionSocket = clientSocket; // Save off the completed connection socket
                    System.out.println("Connected to host: " + opponentName);
                    mainRenderFrame.hideConnectionDialog();
                }
                catch (IOException e) {
                    e.printStackTrace();
                }
            }
        });
        connectThread.start();
        mainRenderFrame.showConnectionDialog("Connecting to host...");
        try {
            connectThread.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }