@Override
    public void cleanup() {
        super.cleanup();
        client.removeMessageListener(this);
        
        if(!stateSwitch && client != null && client.isConnected()) {
            client.close();
        }
    }