Add transport-{api,tcp}
[netconf.git] / transport / transport-api / src / main / java / org / opendaylight / netconf / transport / api / AbstractOverlayTransportChannel.java
1 /*
2  * Copyright (c) 2022 PANTHEON.tech, s.r.o. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.netconf.transport.api;
9
10 import static java.util.Objects.requireNonNull;
11
12 import com.google.common.base.MoreObjects.ToStringHelper;
13 import io.netty.channel.Channel;
14
15 /**
16  * Abstract base class for {@link TransportChannel}s overlaid on another {@link TransportChannel}.
17  */
18 public abstract class AbstractOverlayTransportChannel extends TransportChannel {
19     private final TransportChannel underlay;
20
21     protected AbstractOverlayTransportChannel(final TransportChannel tcp) {
22         underlay = requireNonNull(tcp);
23     }
24
25     @Override
26     public final Channel channel() {
27         return underlay.channel();
28     }
29
30     @Override
31     protected ToStringHelper addToStringAttributes(final ToStringHelper helper) {
32         return helper.add("underlay", underlay);
33     }
34 }