Package org.asynchttpclient.providers.grizzly.filters.events

Examples of org.asynchttpclient.providers.grizzly.filters.events.SSLSwitchingEvent


        if (type == ContinueEvent.class) {
            final ContinueEvent continueEvent = (ContinueEvent) event;
            ((ExpectHandler) continueEvent.getContext().getBodyHandler()).finish(ctx);
        } else if (type == TunnelRequestEvent.class) {
            // Disable SSL for the time being...
            ctx.notifyDownstream(new SSLSwitchingEvent(false, ctx.getConnection()));
            ctx.suspend();
            TunnelRequestEvent tunnelRequestEvent = (TunnelRequestEvent) event;
            final ProxyServer proxyServer = tunnelRequestEvent.getProxyServer();
            final Uri requestUri = tunnelRequestEvent.getUri();

            RequestBuilder builder = new RequestBuilder();
            builder.setMethod(Method.CONNECT.getMethodString());
            builder.setUrl("http://" + getAuthority(requestUri));
            Request request = builder.build();

            AsyncHandler handler = new AsyncCompletionHandler() {
                @Override
                public Object onCompleted(Response response) throws Exception {
                    if (response.getStatusCode() != 200) {
                        PROXY_AUTH_FAILURE.set(ctx.getConnection(), Boolean.TRUE);
                    }
                    ctx.notifyDownstream(new SSLSwitchingEvent(true, ctx.getConnection()));
                    ctx.notifyDownstream(event);
                    return response;
                }
            };
            final GrizzlyResponseFuture future = new GrizzlyResponseFuture(grizzlyAsyncHttpProvider, request, handler, proxyServer);
View Full Code Here


    @Override
    public NextAction handleEvent(final FilterChainContext ctx, final FilterChainEvent event) throws IOException {

        if (event.type() == SSLSwitchingEvent.class) {
            final SSLSwitchingEvent se = (SSLSwitchingEvent) event;
            setSecureStatus(se.getConnection(), se.isSecure());
            return ctx.getStopAction();
        }
        return ctx.getInvokeAction();
    }
View Full Code Here

TOP

Related Classes of org.asynchttpclient.providers.grizzly.filters.events.SSLSwitchingEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.