public void reconnect() {

        /*
         *                   I dedicate this method to
         *
         *       ~~~~THE IDIOT THAT WROTE Socket.isConnected()~~~~
         *
         *    For the amazing ability to write poor documentation and
         *    make poor decisions even when faced with the most easily
         *                     accomplished tasks.
         *
         *  Thanks to his/her service to the Java language and community,
         *  I was able to learn a great deal of things about debugging in
         *           Java, and learn a valuable lesson in life.
         *
         *                       In short, RTFM.
         *
         *                Dedication by Philip Rodning
         *                       April 27, 2014
         */

        System.err.println(System.currentTimeMillis() + " [WARN]    Connection failed or new connection, attempting to reconnect (" + reconnectTries + ")...");

        Platform.runLater(new RunRCMethod(rc, RCMethod.ON_DISCONNECT));

        /*
         * Make sure that any other parts of the code that might attempt to reconnect()
         * are aware that this method has already been called.
         */
        connected = false;

        try {
            //if the socket is still open, close it
            if (socket != null && socket.isConnected())
                socket.close();
        } catch (IOException e) {
            
        }

        try {
            socket = new Socket(host, port);
            in = null;
            System.err.println(System.currentTimeMillis() + " [INFO]    Connection successfully established");
        } catch (IOException e) {
            socket = null;
            System.err.print(" failed.");
            if (reconnectTries < maxReconnectTries) {
                System.err.println(" retrying in 5 seconds");
                Timer timer = new Timer();
                timer.schedule(new ReconnectTask(), 5000);
            } else {
                System.err.println();
                System.err.println(System.currentTimeMillis() + " [WARN]    Attempts to reconnect failed, abandoning connection.");
            }

            reconnectTries++;
        }

        if(socket != null && !socket.isClosed()) {
            Platform.runLater(new RunRCMethod(rc, RCMethod.ON_CONNECT));
            //rc.onConnect();
            connected = true;
            reconnectTries = 0;
        }
    }