func (c *MLLPClient) Write(message []byte) error {
	log.Debugf("MLLP: Writing %q", message)
	if _, err := c.w.Write([]byte{mllpStartBlock}); err != nil {
		log.WithError(err).Warning("Cannot write mllp start block")
		return err
	}
	if _, err := c.w.Write(message); err != nil {
		log.WithError(err).Warning("Cannot write mllp message")
		return err
	}
	if _, err := c.w.Write([]byte{mllpEndBlock, mllpCarriageReturn}); err != nil {
		log.WithError(err).Warning("Cannot write mllp end block")
		return err
	}
	return nil
}
Write writes a message to MLLP client.
Returns an error if writing a message fails.
package hl7
import (
	"bufio"
	"io"
	"net"
	"github.com/pkg/errors"
	"github.com/google/simhospital/pkg/logging"
)
const (
	mllpStartBlock     = 0x0b
	mllpEndBlock       = 0x1c
	mllpCarriageReturn = 0x0d
)
var log = logging.ForCallerPackage()
type MLLPClient struct {
	r *bufio.Reader
	w io.Writer
}
func NewMLLPClient(c net.Conn) *MLLPClient {
	return &MLLPClient{bufio.NewReader(c), c}
}