def time_remaining(timeout)
      return unless timeout
      raise Socketry::InternalError, "no deadline set" unless @deadline

      remaining = @deadline - lifetime
      raise Socketry::TimeoutError, "time expired" if remaining <= 0

      remaining
    end
def time_remaining(timeout)
      return unless timeout
      raise Socketry::InternalError, "no deadline set" unless @deadline

      remaining = @deadline - lifetime
      raise Socketry::TimeoutError, "time expired" if remaining <= 0

      remaining
    end
Calculate number of seconds remaining until we hit the timeout

 @param timeout [Numeric] to gauge whether a timeout needs to be calculated
 @return [Float] number of seconds remaining until we hit the timeout
 @raise [Socketry::TimeoutError] if we've already hit the timeout
 @raise [Socketry::InternalError] if timeout has not been set