public long ping() {
    	if (connection == null) return -1;
    	try {
    		long start = System.currentTimeMillis();
    		if (LOGGER.isDebugEnabled()) {
				LOGGER.debug("[Redis][Ping][try to ping server:" + start + "]");
			}
    		RedisResult result = handler.request(new ProtoBuilder().array(Protocol.Command.PING).build(), timeout);
    		if (result == null) {
    			throw new RedisTimeoutException();
    		}
    		if (result.getException() != null) {
				throw result.getException();
			}
    		if (LOGGER.isDebugEnabled()) {
				LOGGER.debug("[Redis][Ping][ping finish in " + (System.currentTimeMillis() - start) + " ms]");
			}
    		return System.currentTimeMillis() - start;
		} catch (Throwable e) {
			if (LOGGER.isDebugEnabled()) {
				LOGGER.debug("[Redis][Ping][ping failed with:" + e.getMessage() + "]", e);
			}
			return -1;
		}
    }