func (c *Conn) Read(p []byte) (int, error) {
	c.readLock.Lock()
	defer c.readLock.Unlock()
	if c.readOffset == 0 {
		if err := c.Stream.RecvMsg(c.Response); err != nil {
			return 0, err
		}
	}
	data, err := c.Decode(c.Response, c.readOffset, p)
	if err != nil || len(data) <= (len(p)+c.readOffset) {
		n := len(data) - c.readOffset
		c.readOffset = 0
		c.Response.Reset()
		return n, err
	}
	c.readOffset += len(p)
	return len(p), nil
}
Read implements io.Reader.
package grpc_net_conn
import (
	"net"
	"sync"
	"time"
	"github.com/golang/protobuf/proto"
	"google.golang.org/grpc"
)
type Conn struct {
	Stream grpc.Stream
	Request proto.Message
	Response proto.Message
	ResponseLock *sync.Mutex
	Encode Encoder
	Decode Decoder
	readOffset int
	readLock, writeLock sync.Mutex
}