code: private void register(RegisterAttempt attempt) {
      state.getLogger().debug("Registering session: attempt {}", attempt.attempt);
  
      RegisterRequest request = RegisterRequest.builder()
        .withClient(state.getClientId())
        .withTimeout(sessionTimeout.toMillis())
        .build();
  
      state.getLogger().trace("Sending {}", request);
      connection.reset().<RegisterRequest, RegisterResponse>sendAndReceive(request).whenComplete((response, error) -> {
        if (error == null) {
          state.getLogger().trace("Received {}", response);
          if (response.status() == Response.Status.OK) {
            interval = Duration.ofMillis(response.timeout()).dividedBy(2);
            connection.reset(response.leader(), response.members());
            state.setSessionId(response.session())
              .setState(Session.State.OPEN);
            state.getLogger().info("Registered session {}", response.session());
            attempt.complete();
            keepAlive();
          } else {
            strategy.attemptFailed(attempt);
          }
        } else {
          strategy.attemptFailed(attempt);
        }
      });
    }
docs: Registers a session.