public void run() {
		count = 0;
		ok = true;
		
		int d = new Random().nextInt(10000);
		while (proxy.isRunning()) {
			try {
				if (proxy.isConnected())
					sleep(20000 + d);
				else
					sleep(2000);

				count++;

				ok = false;
				sentTime = System.currentTimeMillis();
				if (proxy.isConnected()) {
					proxy.sendPing("test:" + count);
					waitPong();
				}

				if (!ok) {
					logger.info(" ---> LOOSE connection... reconnecting!");
					proxy.connect(); // reconnect
				}
			} catch (InterruptedException e) {
				logger.log(Level.WARNING, " ---> Error monitoring connection ", e);
			} catch (Exception e) {
				logger.log(Level.WARNING, " ---> Error in communication ", e);
			}
		}
	}