added tests for timeout behavior

Tests for correct behavior when estimateSize times out and fails
for any other reason
Factored out timeout handling
fixed whitespace