func (p *TransPipeline) Read(ctx context.Context, conn net.Conn, msg Message) error {
	return p.netHdlr.Read(ctx, conn, msg)
}
Read reads from conn.
package remote
import (
	"context"
	"net"
)
type BoundHandler interface{}
type OutboundHandler interface {
	BoundHandler
	Write(ctx context.Context, conn net.Conn, send Message) (context.Context, error)
}
type InboundHandler interface {
	BoundHandler
	OnActive(ctx context.Context, conn net.Conn) (context.Context, error)
	OnInactive(ctx context.Context, conn net.Conn) context.Context
	OnRead(ctx context.Context, conn net.Conn) (context.Context, error)
	OnMessage(ctx context.Context, args, result Message) (context.Context, error)
}
type DuplexBoundHandler interface {
	OutboundHandler
	InboundHandler
}
type TransPipeline struct {
	netHdlr TransHandler
	inboundHdrls  []InboundHandler
	outboundHdrls []OutboundHandler
}
var (
	_ TransHandler       = &TransPipeline{}
	_ ServerTransHandler = &TransPipeline{}
)
func newTransPipeline() *TransPipeline {
	return &TransPipeline{}
}
func NewTransPipeline(netHdlr TransHandler) *TransPipeline {
	transPl := newTransPipeline()
	transPl.netHdlr = netHdlr
	netHdlr.SetPipeline(transPl)
	return transPl
}
func (p *TransPipeline) AddInboundHandler(hdlr InboundHandler) *TransPipeline {
	p.inboundHdrls = append(p.inboundHdrls, hdlr)
	return p
}
func (p *TransPipeline) AddOutboundHandler(hdlr OutboundHandler) *TransPipeline {
	p.outboundHdrls = append(p.outboundHdrls, hdlr)
	return p
}
func (p *TransPipeline) Write(ctx context.Context, conn net.Conn, sendMsg Message) error {
	var err error
	for _, h := range p.outboundHdrls {
		ctx, err = h.Write(ctx, conn, sendMsg)
		if err != nil {
			return err
		}
	}
	return p.netHdlr.Write(ctx, conn, sendMsg)
}
func (p *TransPipeline) OnActive(ctx context.Context, conn net.Conn) (context.Context, error) {
	var err error
	for _, h := range p.inboundHdrls {
		ctx, err = h.OnActive(ctx, conn)
		if err != nil {
			return ctx, err
		}
	}
	if netHdlr, ok := p.netHdlr.(ServerTransHandler); ok {
		return netHdlr.OnActive(ctx, conn)
	}
	return ctx, nil
}
func (p *TransPipeline) OnInactive(ctx context.Context, conn net.Conn) {
	for _, h := range p.inboundHdrls {
		ctx = h.OnInactive(ctx, conn)
	}
	p.netHdlr.OnInactive(ctx, conn)
}
func (p *TransPipeline) OnRead(ctx context.Context, conn net.Conn) error {
	var err error
	for _, h := range p.inboundHdrls {
		ctx, err = h.OnRead(ctx, conn)
		if err != nil {
			return err
		}
	}
	if netHdlr, ok := p.netHdlr.(ServerTransHandler); ok {
		return netHdlr.OnRead(ctx, conn)
	}
	return nil
}