* @return true if the session is paused (if the session was ready), false
* otherwise
*/
private final boolean pauseSession() {
logger.info("Pausing connection...");
final StreamSettings stream = session.pause();
if (stream == null)
return false;
final String user = session.getCurrentUserURI().toString();
final Map<String, String> map = Maps.newHashMap();
map.put("rid", "" + stream.rid);
map.put("sid", stream.sid);
map.put("wait", stream.wait);
map.put("inactivity", stream.getInactivityString());
map.put("maxPause", stream.getMaxPauseString());
map.put("user", user);
final String serialized = cookieJoiner.join(map);
Cookies.setCookie(PAUSE_COOKIE, serialized);
logger.finer("Pausing session: " + serialized);