Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.englishtown.vertx.promises.impl;
 
    private final When<HttpClientResponseAndBodyVoidwhen = new When<>();
    @Override
        final Deferred<HttpClientResponseAndBodyVoidd = .defer();
        promise.then(
                new Runnable<Promise<HttpClientResponseVoid>, HttpClientResponse>() {
                    @Override
                    public Promise<HttpClientResponseVoidrun(final HttpClientResponse response) {
                        try {
                            response.exceptionHandler(new Handler<Throwable>() {
                                @Override
                                public void handle(Throwable t) {
                                    reject(dt);
                                }
                            });
                            response.bodyHandler(new Handler<Buffer>() {
                                @Override
                                public void handle(Buffer body) {
                                    d.getResolver().resolve(new DefaultHttpClientResponseAndBody(responsebody));
                                }
                            });
                        } catch (RuntimeException e) {
                            reject(de);
                        }
                        return null;
                    }
                },
                new Runnable<Promise<HttpClientResponseVoid>, Value<HttpClientResponse>>() {
                    @Override
                    public Promise<HttpClientResponseVoidrun(Value<HttpClientResponseresponse) {
                        reject(dresponse.error);
                        return null;
                    }
                }
        );
        return d.getPromise();
    }
    protected void reject(Deferred<HttpClientResponseAndBodyVoiddThrowable t) {
        RuntimeException e = (t == null || t instanceof RuntimeException ? (RuntimeExceptiont : new RuntimeException(t));
        d.getResolver().reject(new Value<HttpClientResponseAndBody>(nulle));
    }
New to GrepCode? Check out our FAQ X