Motivation: In the past we had the following class hierarchy: Http2ConnectionHandler --- Http2FrameCodec -- Http2MultiplexCodec This hierarchy makes it impossible to plug in any code that would like to act on Http2Frame and Http2StreamFrame which can be quite useful for various situations (like metrics, logging etc). Beside this it also made the implementtion very hacky. To allow easier maintainance and also allow more flexible costumizations we should split Http2MultiplexCodec and Http2FrameCode. Modifications: - Introduce Http2MultiplexHandler (which is a replacement for Http2MultiplexCodec when used together with Http2FrameCodec) - Mark Http2MultiplexCodecBuilder and Http2MultiplexCodec as deprecated. People should use Http2FrameCodecBuilder / Http2FrameCodec together with Http2MultiplexHandlder in the future - Adjust / Add tests - Adjust examples Result: More flexible usage possible and less hacky / coupled implementation for http2 multiplexing
35 lines
1.3 KiB
Java
35 lines
1.3 KiB
Java
/*
|
|
* Copyright 2019 The Netty Project
|
|
*
|
|
* The Netty Project licenses this file to you under the Apache License, version 2.0 (the
|
|
* "License"); you may not use this file except in compliance with the License. You may obtain a
|
|
* copy of the License at:
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software distributed under the License
|
|
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
|
* or implied. See the License for the specific language governing permissions and limitations under
|
|
* the License.
|
|
*/
|
|
package io.netty.handler.codec.http2;
|
|
|
|
import io.netty.channel.ChannelHandler;
|
|
|
|
public class Http2MultiplexCodecClientUpgradeTest extends Http2MultiplexClientUpgradeTest<Http2MultiplexCodec> {
|
|
|
|
@Override
|
|
protected Http2MultiplexCodec newCodec(ChannelHandler upgradeHandler) {
|
|
Http2MultiplexCodecBuilder builder = Http2MultiplexCodecBuilder.forClient(new NoopHandler());
|
|
if (upgradeHandler != null) {
|
|
builder.withUpgradeStreamHandler(upgradeHandler);
|
|
}
|
|
return builder.build();
|
|
}
|
|
|
|
@Override
|
|
protected ChannelHandler newMultiplexer(ChannelHandler upgradeHandler) {
|
|
return null;
|
|
}
|
|
}
|