add configurable socket timeout to http client

I would like to be able configure socket timeout for http client. 

I did not find a nice way to unit test this feature. Do you have any suggestions? 

I can confirm that this code works in private project where it is covered with end to end test.