Set timeout and connect timeout.