// 
// Decompiled by Procyon v0.6.0
// 

package io.netty.handler.codec.http3;

import io.netty.handler.codec.quic.QuicStreamChannel;
import io.netty.channel.ChannelHandlerContext;
import org.jetbrains.annotations.Nullable;
import io.netty.channel.ChannelHandler;
import java.util.function.LongFunction;

public final class Http3ClientConnectionHandler extends Http3ConnectionHandler
{
    private final LongFunction<ChannelHandler> pushStreamHandlerFactory;
    
    public Http3ClientConnectionHandler() {
        this(null, null, null, null, true);
    }
    
    public Http3ClientConnectionHandler(@Nullable final ChannelHandler inboundControlStreamHandler, @Nullable final LongFunction<ChannelHandler> pushStreamHandlerFactory, @Nullable final LongFunction<ChannelHandler> unknownInboundStreamHandlerFactory, @Nullable final Http3SettingsFrame localSettings, final boolean disableQpackDynamicTable) {
        super(false, inboundControlStreamHandler, unknownInboundStreamHandlerFactory, localSettings, disableQpackDynamicTable);
        this.pushStreamHandlerFactory = pushStreamHandlerFactory;
    }
    
    @Override
    void initBidirectionalStream(final ChannelHandlerContext ctx, final QuicStreamChannel channel) {
        Http3CodecUtils.connectionError(ctx, Http3ErrorCode.H3_STREAM_CREATION_ERROR, "Server initiated bidirectional streams are not allowed", true);
    }
    
    @Override
    void initUnidirectionalStream(final ChannelHandlerContext ctx, final QuicStreamChannel streamChannel) {
        final long maxTableCapacity = this.maxTableCapacity();
        streamChannel.pipeline().addLast(new Http3UnidirectionalStreamInboundClientHandler(this.codecFactory, this.localControlStreamHandler, this.remoteControlStreamHandler, this.unknownInboundStreamHandlerFactory, this.pushStreamHandlerFactory, () -> new QpackEncoderHandler(maxTableCapacity, this.qpackDecoder), () -> new QpackDecoderHandler(this.qpackEncoder)));
    }
}
