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

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

Introduction

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

Prototype

public SpdyHttpEncoder(SpdyVersion version) 

Source Link

Document

Creates a new instance.

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 www  .j  a  va  2  s.  co  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 .j  av  a  2 s.c om
 * @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());
}