func SendFramedResponse(w io.Writer, frameType int32, data []byte) (int, error) {
	beBuf := make([]byte, 4)
	size := uint32(len(data)) + 4
	binary.BigEndian.PutUint32(beBuf, size)
	n, err := w.Write(beBuf)
	if err != nil {
		return n, err
	}
	binary.BigEndian.PutUint32(beBuf, uint32(frameType))
	n, err = w.Write(beBuf)
	if err != nil {
		return n + 4, err
	}
	n, err = w.Write(data)
	return n + 8, err
}
SendFramedResponse is a server side utility function to prefix data with a length header
and frame header and write to the supplied Writer
package protocol
import (
	"encoding/binary"
	"io"
	"net"
)
type Protocol interface {
	IOLoop(conn net.Conn) error
}
func SendResponse(w io.Writer, data []byte) (int, error) {
	err := binary.Write(w, binary.BigEndian, int32(len(data)))
	if err != nil {
		return 0, err
	}
	n, err := w.Write(data)
	if err != nil {
		return 0, err
	}
	return (n + 4), nil
}