@Test public void settingsWriteShouldNotUpdateSettings() throws Exception { Http2Settings settings = new Http2Settings(); settings.initialWindowSize(100); settings.maxConcurrentStreams(1000); settings.headerTableSize(2000); ChannelPromise promise = newPromise(); encoder.writeSettings(ctx, settings, promise); verify(writer).writeSettings(eq(ctx), eq(settings), eq(promise)); }
@Override public ChannelFuture writeSettings(ChannelHandlerContext ctx, Http2Settings settings, ChannelPromise promise) { outstandingLocalSettingsQueue.add(settings); try { Boolean pushEnabled = settings.pushEnabled(); if (pushEnabled != null && connection.isServer()) { throw connectionError(PROTOCOL_ERROR, "Server sending SETTINGS frame with ENABLE_PUSH specified"); } } catch (Throwable e) { return promise.setFailure(e); } return frameWriter.writeSettings(ctx, settings, promise); }
DefaultHttp2ConnectionEncoder implements Http2ConnectionEncoder { @Override public ChannelFuture writeSettings(ChannelHandlerContext ctx, Http2Settings settings, ChannelPromise promise) { outstandingLocalSettingsQueue.add(settings); try { Boolean pushEnabled = settings.pushEnabled(); if (pushEnabled != null && connection.isServer()) { throw connectionError(PROTOCOL_ERROR, "Server sending SETTINGS frame with ENABLE_PUSH specified"); } } catch (Throwable e) { return promise.setFailure(e); } return frameWriter.writeSettings(ctx, settings, promise); } }
DefaultHttp2ConnectionEncoder implements Http2ConnectionEncoder { @Override public ChannelFuture writeSettings(ChannelHandlerContext ctx, Http2Settings settings, ChannelPromise promise) { outstandingLocalSettingsQueue.add(settings); try { Boolean pushEnabled = settings.pushEnabled(); if (pushEnabled != null && connection.isServer()) { throw connectionError(PROTOCOL_ERROR, "Server sending SETTINGS frame with ENABLE_PUSH specified"); } } catch (Throwable e) { return promise.setFailure(e); } return frameWriter.writeSettings(ctx, settings, promise); } DefaultHttp2ConnectionEncoder(Http2Connection connection, Http2FrameWriter frameWriter); }
DefaultHttp2ConnectionEncoder implements Http2ConnectionEncoder { @Override public ChannelFuture writeSettings(ChannelHandlerContext ctx, Http2Settings settings, ChannelPromise promise) { outstandingLocalSettingsQueue.add(settings); try { Boolean pushEnabled = settings.pushEnabled(); if (pushEnabled != null && connection.isServer()) { throw connectionError(PROTOCOL_ERROR, "Server sending SETTINGS frame with ENABLE_PUSH specified"); } } catch (Throwable e) { return promise.setFailure(e); } return frameWriter.writeSettings(ctx, settings, promise); } DefaultHttp2ConnectionEncoder(Http2Connection connection, Http2FrameWriter frameWriter); @Override void lifecycleManager(Http2LifecycleManager lifecycleManager); @Override Http2FrameWriter frameWriter(); @Override Http2Connection connection(); @Override final Http2RemoteFlowController flowController(); @Override void remoteSettings(Http2Settings settings); @Override ChannelFuture writeData(final ChannelHandlerContext ctx, final int streamId, ByteBuf data, int padding,
            final boolean endOfStream, ChannelPromise promise); @Override ChannelFuture writeHeaders(ChannelHandlerContext ctx, int streamId, Http2Headers headers, int padding,
            boolean endStream, ChannelPromise promise); @Override ChannelFuture writeHeaders(final ChannelHandlerContext ctx, final int streamId,
            final Http2Headers headers, final int streamDependency, final short weight,
            final boolean exclusive, final int padding, final boolean endOfStream, ChannelPromise promise); @Override ChannelFuture writePriority(ChannelHandlerContext ctx, int streamId, int streamDependency, short weight,
            boolean exclusive, ChannelPromise promise); @Override ChannelFuture writeRstStream(ChannelHandlerContext ctx, int streamId, long errorCode,
            ChannelPromise promise); @Override ChannelFuture writeSettings(ChannelHandlerContext ctx, Http2Settings settings,
            ChannelPromise promise); @Override ChannelFuture writeSettingsAck(ChannelHandlerContext ctx, ChannelPromise promise); @Override ChannelFuture writePing(ChannelHandlerContext ctx, boolean ack, long data, ChannelPromise promise); @Override ChannelFuture writePushPromise(ChannelHandlerContext ctx, int streamId, int promisedStreamId,
            Http2Headers headers, int padding, ChannelPromise promise); @Override ChannelFuture writeGoAway(ChannelHandlerContext ctx, int lastStreamId, long errorCode, ByteBuf debugData,
            ChannelPromise promise); @Override ChannelFuture writeWindowUpdate(ChannelHandlerContext ctx, int streamId, int windowSizeIncrement,
            ChannelPromise promise); @Override ChannelFuture writeFrame(ChannelHandlerContext ctx, byte frameType, int streamId, Http2Flags flags,
            ByteBuf payload, ChannelPromise promise); @Override void close(); @Override Http2Settings pollSentSettings(); @Override Configuration configuration(); }
DefaultHttp2ConnectionEncoder implements Http2ConnectionEncoder { @Override public ChannelFuture writeSettings(ChannelHandlerContext ctx, Http2Settings settings, ChannelPromise promise) { outstandingLocalSettingsQueue.add(settings); try { Boolean pushEnabled = settings.pushEnabled(); if (pushEnabled != null && connection.isServer()) { throw connectionError(PROTOCOL_ERROR, "Server sending SETTINGS frame with ENABLE_PUSH specified"); } } catch (Throwable e) { return promise.setFailure(e); } return frameWriter.writeSettings(ctx, settings, promise); } DefaultHttp2ConnectionEncoder(Http2Connection connection, Http2FrameWriter frameWriter); @Override void lifecycleManager(Http2LifecycleManager lifecycleManager); @Override Http2FrameWriter frameWriter(); @Override Http2Connection connection(); @Override final Http2RemoteFlowController flowController(); @Override void remoteSettings(Http2Settings settings); @Override ChannelFuture writeData(final ChannelHandlerContext ctx, final int streamId, ByteBuf data, int padding,
            final boolean endOfStream, ChannelPromise promise); @Override ChannelFuture writeHeaders(ChannelHandlerContext ctx, int streamId, Http2Headers headers, int padding,
            boolean endStream, ChannelPromise promise); @Override ChannelFuture writeHeaders(final ChannelHandlerContext ctx, final int streamId,
            final Http2Headers headers, final int streamDependency, final short weight,
            final boolean exclusive, final int padding, final boolean endOfStream, ChannelPromise promise); @Override ChannelFuture writePriority(ChannelHandlerContext ctx, int streamId, int streamDependency, short weight,
            boolean exclusive, ChannelPromise promise); @Override ChannelFuture writeRstStream(ChannelHandlerContext ctx, int streamId, long errorCode,
            ChannelPromise promise); @Override ChannelFuture writeSettings(ChannelHandlerContext ctx, Http2Settings settings,
            ChannelPromise promise); @Override ChannelFuture writeSettingsAck(ChannelHandlerContext ctx, ChannelPromise promise); @Override ChannelFuture writePing(ChannelHandlerContext ctx, boolean ack, long data, ChannelPromise promise); @Override ChannelFuture writePushPromise(ChannelHandlerContext ctx, int streamId, int promisedStreamId,
            Http2Headers headers, int padding, ChannelPromise promise); @Override ChannelFuture writeGoAway(ChannelHandlerContext ctx, int lastStreamId, long errorCode, ByteBuf debugData,
            ChannelPromise promise); @Override ChannelFuture writeWindowUpdate(ChannelHandlerContext ctx, int streamId, int windowSizeIncrement,
            ChannelPromise promise); @Override ChannelFuture writeFrame(ChannelHandlerContext ctx, byte frameType, int streamId, Http2Flags flags,
            ByteBuf payload, ChannelPromise promise); @Override void close(); @Override Http2Settings pollSentSettings(); @Override Configuration configuration();  }