@Test
    public void monitor() {
	new Thread(new Runnable() {
	    public void run() {
		try {
		    // sleep 100ms to make sure that monitor thread runs first
		    Thread.sleep(100);
		} catch (InterruptedException e) {
		}
		Jedis j = new Jedis("localhost");
		j.auth("foobared");
		for (int i = 0; i < 5; i++) {
		    j.incr("foobared");
		}
		j.disconnect();
	    }
	}).start();

	jedis.monitor(new JedisMonitor() {
	    private int count = 0;

	    public void onCommand(String command) {
		if (command.contains("INCR")) {
		    count++;
		}
		if (count == 5) {
		    client.disconnect();
		}
	    }
	});
    }