TS-2416: configurable TLS session timeout threshold

Default is 300 seconds. It's good to be configurable so that
application can specify the threshold for the expiration of internal
session and session ticket.
TS-2351 Make the Range calculations more resilient