func NewNATSTransport(conn *nats.Conn, listenTo, replyTo, heartbeat string,
	readTimeout, heartbeatInterval time.Duration) thrift.TTransport {

	reader, writer := io.Pipe()
	timeoutReader := newTimeoutReader(reader)
	timeoutReader.SetTimeout(readTimeout)
	buf := make([]byte, 0, maxMessageSize)
	return &natsTransport{
		conn:              conn,
		listenTo:          listenTo,
		replyTo:           replyTo,
		reader:            timeoutReader,
		writer:            writer,
		heartbeat:         heartbeat,
		heartbeatInterval: heartbeatInterval,
		closed:            make(chan struct{}),
		writeBuffer:       bytes.NewBuffer(buf),
	}
}
// NewNATSTransport returns a Thrift TTransport which uses the NATS messaging
// system as the underlying transport. This TTransport can only be used with
// NATSServer.
NewNATSTransport returns a Thrift TTransport which uses the NATS messaging
system as the underlying transport. This TTransport can only be used with
NATSServer.
// NewNATSTransport returns a Thrift TTransport which uses the NATS messaging // system as the underlying transport . This TTransport can only be used with // NATSServer .
func NewNATSTransport(conn *nats.Conn, listenTo, replyTo, heartbeat string,
	readTimeout, heartbeatInterval time.Duration) thrift.TTransport {
	reader, writer := io.Pipe()
	timeoutReader := newTimeoutReader(reader)
	timeoutReader.SetTimeout(readTimeout)
	buf := make([]byte, 0, maxMessageSize)
	return &natsTransport{
		conn:              conn,
		listenTo:          listenTo,
		replyTo:           replyTo,
		reader:            timeoutReader,
		writer:            writer,
		heartbeat:         heartbeat,
		heartbeatInterval: heartbeatInterval,
		closed:            make(chan struct{}),
		writeBuffer:       bytes.NewBuffer(buf),
	}
}
func NewNATSTransport ( conn * nats . Conn , listenTo , replyTo , heartbeat string , readTimeout , heartbeatInterval time . Duration ) thrift . TTransport { reader , writer := io . Pipe ( ) timeoutReader := newTimeoutReader ( reader ) timeoutReader . SetTimeout ( readTimeout ) buf := make ( [ ] byte , 0 , maxMessageSize ) return & natsTransport { conn : conn , listenTo : listenTo , replyTo : replyTo , reader : timeoutReader , writer : writer , heartbeat : heartbeat , heartbeatInterval : heartbeatInterval , closed : make ( chan struct { } ) , writeBuffer : bytes . NewBuffer ( buf ) , } }
NewNATSTransport returns a Thrift TTransport which uses the NATS messaging
system as the underlying transport.
NewNATSTransport returns a Thrift TTransport which uses the NATS messaging system as the underlying transport .