class HttpUtils {

    public static <T> T waitFor(Future<? extends T> future) throws IOException {
        try {
            return future.get();
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();  // reset interrupted flag
            throw new IOException(e);
        } catch (ExecutionException e) {
            throw wrapInIOException(e.getCause());
        }
    }

    private  HttpUtils();

}