code: public void reconnect() throws IOException, SlackApiException, URISyntaxException, DeploymentException {
          // Call rtm.connect again to refresh wss URL
          RTMConnectResponse response = slack.methods().rtmConnect(RTMConnectRequest.builder().token(botApiToken).build());
          if (response.isOk()) {
              this.wssUri = new URI(response.getUrl());
              this.connectedBotUser = response.getSelf();
          } else {
              throw new IllegalStateException("Failed to the RTM endpoint URL (error: " + response.getError() + ")");
          }
          // start a WebSocket session
          connect();
      }
docs: Re-connects to a new wss endpoint and starts a new WebSocket session.
  This method calls rtm.connect API. Please be aware of the rate limit.
  https://api.slack.com/docs/rate-limits#rtm