import java.util.concurrent.TimeUnit;
public class BlockingHttpClient {
public ReceivedResponse request(URI uri, long timeout, TimeUnit timeUnit, Action<? super RequestSpec> action) throws Throwable {
try (ExecController execController = new DefaultExecController(2)) {
final RequestAction requestAction = new RequestAction(uri, execController, action);
execController.getControl().exec()
.onError(throwable -> requestAction.setResult(Result.<ReceivedResponse>failure(throwable)))
.start(requestAction::execute);
try {
// TODO - make this configurable