public RPC() {

        setupEventListeners();
        
        /**
         * Thread will endlessly call executeNext() method
         */
        // TODO: Move out from RPC
        thread = new Thread(new Runnable() {
            @Override
            public void run() {
                while (true) {
                    try {
                        // TODO: run CheckVersion to determine connection state, and only then fire CE event
                        Logger.getInstance().info("RPC thread (re)started");
                        EventBusFactory.getDefault().fire(new RpcThreadStartedEvent());
                        EventBusFactory.getDefault().fire(new ConnectionEstablishedEvent());

                        while (true) {
                            Logger.getInstance().info("executeNext");
                            executeNext();
                        }
                    } catch (InterruptedException e) {
                        // Do nothing. Just continue loop.
                    }
                }
            }
        }, "RPC worker");


        clientConfig = new XmlRpcClientConfigImpl();
        client = new XmlRpcClient();
        client.setTypeFactory(new ESTypeFactoryImpl(client));
        loadConfig();

        //TODO: is it needed?
        //thread.setDaemon(true);
        thread.start();
    }