code: URI resolveServiceEndpoint(String bucketName) {
  
          if (getSignerRegion() != null || isSignerOverridden()) return endpoint;
  
          final String regionStr = fetchRegionFromCache(bucketName);
          final com.amazonaws.regions.Region region = RegionUtils.getRegion(regionStr);
  
          if (region == null) {
              log.warn("Region information for "
                      + regionStr
                      + " is not available. Please upgrade to latest version of AWS Java SDK");
          }
  
          return region != null
                  ? RuntimeHttpUtils.toUri(region.getServiceEndpoint(S3_SERVICE_NAME), clientConfiguration)
                  : endpoint;
      }
docs: Specifically made package access for testing.
  Used for internal consumption of AWS SDK.
  
  Tries to determine the service endpoint for the bucket name.
  Returns the endpoint configured in the client if the region cannot be determined.