X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=netconf%2Fnetconf-netty-util%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fnetconf%2Fnettyutil%2Fhandler%2Fssh%2Fclient%2FNetconfClientSessionImpl.java;h=0f8435235a0506172a56ea8e6bf4d4b1ade08bef;hb=1f754eb1b78fb0dda5dba1a1d17f4b15671d95e8;hp=1a465d888765608fe7a4f8823b6ad8d430ad7ff0;hpb=30fff497ee7c7872d05b9d4a468794bdd81debe6;p=netconf.git diff --git a/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/NetconfClientSessionImpl.java b/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/NetconfClientSessionImpl.java index 1a465d8887..0f8435235a 100644 --- a/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/NetconfClientSessionImpl.java +++ b/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/NetconfClientSessionImpl.java @@ -7,6 +7,8 @@ */ package org.opendaylight.netconf.nettyutil.handler.ssh.client; +import static java.util.Objects.requireNonNull; + import com.google.common.annotations.Beta; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelPipeline; @@ -27,18 +29,30 @@ public final class NetconfClientSessionImpl extends ClientSessionImpl implements } @Override - public NettyAwareChannelSubsystem createSubsystemChannel(final String subsystem, final ChannelHandlerContext ctx) + public ChannelSubsystem createSubsystemChannel(final String subsystem, final ChannelHandlerContext ctx) throws IOException { - return registerSubsystem(new NettyAwareChannelSubsystem(subsystem, ctx)); + requireNonNull(ctx); + return registerSubsystem(new NettyChannelSubsystem(subsystem) { + @Override + ChannelHandlerContext context() { + return ctx; + } + }); } @Override - public NettyPipelineAwareChannelSubsystem createSubsystemChannel(final String subsystem, + public ChannelSubsystem createSubsystemChannel(final String subsystem, final ChannelPipeline pipeline) throws IOException { - return registerSubsystem(new NettyPipelineAwareChannelSubsystem(subsystem, pipeline)); + requireNonNull(pipeline); + return registerSubsystem(new NettyChannelSubsystem(subsystem) { + @Override + ChannelHandlerContext context() { + return pipeline.firstContext(); + } + }); } - private T registerSubsystem(final T subsystem) throws IOException { + private ChannelSubsystem registerSubsystem(final ChannelSubsystem subsystem) throws IOException { final var service = getConnectionService(); final var id = service.registerChannel(subsystem); if (log.isDebugEnabled()) {