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

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

Introduction

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

Prototype

public SpdyFrameCodec(SpdyVersion version) 

Source Link

Document

Creates a new instance with the specified version , validateHeaders (true) , and the default decoder and encoder options ( maxChunkSize (8192) , maxHeaderSize (16384) , compressionLevel (6) , windowBits (15) , and memLevel (8) ).

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   w  w  w . ja v  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./*from w w w.  ja  va  2s.co  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());
}