Example usage for io.netty.handler.codec.spdy SpdySessionHandler SpdySessionHandler

List of usage examples for io.netty.handler.codec.spdy SpdySessionHandler SpdySessionHandler

Introduction

In this page you can find the example usage for io.netty.handler.codec.spdy SpdySessionHandler SpdySessionHandler.

Prototype

public SpdySessionHandler(SpdyVersion version, boolean server) 

Source Link

Document

Creates a new session handler.

Usage

From source file:com.flysoloing.learning.network.netty.spdy.client.SpdyClientInitializer.java

License:Apache License

@Override
public void initChannel(SocketChannel ch) {
    ChannelPipeline pipeline = ch.pipeline();
    pipeline.addLast("ssl", sslCtx.newHandler(ch.alloc()));
    pipeline.addLast("spdyFrameCodec", new SpdyFrameCodec(SPDY_3_1));
    pipeline.addLast("spdyFrameLogger", new SpdyFrameLogger(INFO));
    pipeline.addLast("spdySessionHandler", new SpdySessionHandler(SPDY_3_1, false));
    pipeline.addLast("spdyHttpEncoder", new SpdyHttpEncoder(SPDY_3_1));
    pipeline.addLast("spdyHttpDecoder", new SpdyHttpDecoder(SPDY_3_1, MAX_SPDY_CONTENT_LENGTH));
    pipeline.addLast("spdyStreamIdHandler", new SpdyClientStreamIdHandler());
    pipeline.addLast("httpHandler", httpResponseHandler);
}

From source file:com.flysoloing.learning.network.netty.spdy.server.SpdyOrHttpHandler.java

License:Apache License

private static void configureSpdy(ChannelHandlerContext ctx, SpdyVersion version) throws Exception {
    ChannelPipeline p = ctx.pipeline();//from  ww  w . jav a  2s .c  o m
    p.addLast(new SpdyFrameCodec(version));
    p.addLast(new SpdySessionHandler(version, true));
    p.addLast(new SpdyHttpEncoder(version));
    p.addLast(new SpdyHttpDecoder(version, MAX_CONTENT_LENGTH));
    p.addLast(new SpdyHttpResponseStreamIdHandler());
    p.addLast(new SpdyServerHandler());
}

From source file:com.hop.hhxx.example.spdy.client.SpdyClientInitializer.java

License:Apache License

@Override
public void initChannel(SocketChannel ch) {
    ChannelPipeline pipeline = ch.pipeline();
    pipeline.addLast("ssl", sslCtx.newHandler(ch.alloc()));
    pipeline.addLast("spdyFrameCodec", new SpdyFrameCodec(SPDY_3_1));
    pipeline.addLast("spdyFrameLogger", new io.netty.example.spdy.client.SpdyFrameLogger(INFO));
    pipeline.addLast("spdySessionHandler", new SpdySessionHandler(SPDY_3_1, false));
    pipeline.addLast("spdyHttpEncoder", new SpdyHttpEncoder(SPDY_3_1));
    pipeline.addLast("spdyHttpDecoder", new SpdyHttpDecoder(SPDY_3_1, MAX_SPDY_CONTENT_LENGTH));
    pipeline.addLast("spdyStreamIdHandler", new SpdyClientStreamIdHandler());
    pipeline.addLast("httpHandler", httpResponseHandler);
}

From source file:org.pidome.server.system.network.http.HttpProtocolNegotiator.java

/**
 * Configures the channel to use spdy.// ww w  .j a  va  2s.c  o m
 * @param ctx The channel handler.
 * @param version The spdy version.
 * @param port The port used.
 * @throws Exception When the channel can not be configured.
 */
private static void configureSpdy(ChannelHandlerContext ctx, SpdyVersion version, int port) throws Exception {
    ctx.pipeline().addLast(new SpdyFrameCodec(version)).addLast(new SpdySessionHandler(version, true))
            .addLast(new SpdyHttpEncoder(version)).addLast(new SpdyHttpDecoder(version, 5242880))
            .addLast(new SpdyHttpResponseStreamIdHandler()).addLast(new HttpClientHandler(true, port))
            .addLast(new UserEventLogger());
}