public void onDisconnect() {
        // Autoreconnect with 30 second pauses between retries.
        while(!isConnected()) {
            try {
                reconnect();
            }
            catch(Exception e1) {
                try {
                    Thread.sleep(30000);
                } catch (Exception e2) {
                    // Do nothing.
                }
            }
        }
    }