class VolleyX {

    public static <T> Observable<T> from(final Request<T> request) {
        if (!sInited) throw new IllegalStateException("call init first");
        if (request == null) throw new NullPointerException("request can not be null");
        return Observable.defer(new Func0<Observable<T>>() {
            @Override
            public Observable<T> call() {
                try {
                    return Observable.just(generateData(request));
                } catch (InterruptedException | ExecutionException e) {
                    VolleyXLog.e(e.getMessage());
                    return Observable.error(e);
                }
            }
        });
    }

}