public void setPresent(final UUID accountUuid, final byte deviceId,
      final DisplacedPresenceListener displacementListener) {

    setPresenceTimer.record(() -> {
      final String presenceKey = getPresenceKey(accountUuid, deviceId);

      displacePresence(presenceKey, true);

      displacementListenersByPresenceKey.put(presenceKey, displacementListener);

      presenceCluster.useCluster(connection -> {
        final RedisAdvancedClusterCommands<String, String> commands = connection.sync();

        commands.sadd(connectedClientSetKey, presenceKey);
        commands.setex(presenceKey, PRESENCE_EXPIRATION_SECONDS, managerId);
      });

      subscribeForRemotePresenceChanges(presenceKey);
    });
  }
@Test
  void testLocalDisplacement() {
    final UUID accountUuid = UUID.randomUUID();
    final byte deviceId = 1;

    final AtomicInteger displacementCounter = new AtomicInteger(0);
    final DisplacedPresenceListener displacementListener = connectedElsewhere -> displacementCounter.incrementAndGet();

    clientPresenceManager.setPresent(accountUuid, deviceId, displacementListener);

    assertEquals(0, displacementCounter.get());

    clientPresenceManager.setPresent(accountUuid, deviceId, displacementListener);

    assertEquals(1, displacementCounter.get());
  }