SeleniumHQ/selenium — pull request #227 by yurloc (2014-06-16 15:13:10+00:00)
Title: Issue 3951: Make HTTP client socket timeout configurable

This is a proposed fix for [Issue 3951](https://code.google.com/p/selenium/issues/detail?id=3951).

I decided not to make the timeout configurable through API for these reasons:
* This setting is not browser related so it doesn't fit into Capabilities.
* API would have to allow access to HttpClientFactory from a RemoteWebDriver instance through its HttpCommandExecutor (as suggested in [Issue 3951, comment #39](https://code.google.com/p/selenium/issues/detail?id=3951#c39)) to change the timeout value *before* the HttpClient instance is actually created (HttpClient would need to be instantiated lazily on the first call of `HttpCommandExecutor#execute()`, not in HttpCommandExecutor's constructor like it is now). This would result in unnecessary code complexity and an API allowing illegal changing of the socket timeout in the state where HttpClient is already created and its configuration cannot be changed.
* This is a corner case configuration and it makes sense to use the most widely suitable default, possible to override with a System property.

I also took the liberty of decreasing the default to 60 seconds. This value is suggested by Kristian Rosenvold in his commit 3f73032360e65d12f6c12a47f507697c0981b4a3 where he also explains why a bigger timeout is needed in grid environment. I hope the lesser timeout won't have negative effects since there already is a method [HttpClientFactory#getGridHttpClient(int, int)](https://github.com/SeleniumHQ/selenium/blob/c8ed0c89e45518f4e702ca26eefc7d90dba6ec84/java/client/src/org/openqa/selenium/remote/internal/HttpClientFactory.java#L96) which takes socket timeout as a parameter. In any case it is possible to override the default socket timeout value with `webdriver.remote.http.socket.timeout` System property.

Review needed, especially comments from someone who can confirm this will not break things in the grid environment.