func (sc *RaftSimpleClient) Flush() error {
	return sc.writer.Flush()
}
Flush writes all buffered data to the underlying TCP connection
package raft_client
import (
	"bufio"
	"encoding/binary"
	"errors"
	"fmt"
	"io"
	"mraft/store"
	"net"
	"sync"
	"time"
)
const defaultBufferSize = 5 * 1024
var ErrStopped = errors.New("stopped")
type ProducerTransaction struct {
	cmd      interface{}
	doneChan chan *ProducerTransaction
	Resp     *store.RaftAttribute
	Error    error
}
type RaftSimpleClient struct {
	mu *sync.Mutex
	conn net.Conn
	reader *bufio.Reader
	writer *bufio.Writer
	responseChan chan []byte
	transactionChan chan *ProducerTransaction
	transactions    []*ProducerTransaction
	exitChan chan struct{}
}
func NewRaftSimpleClient(address string) (*RaftSimpleClient, error) {
	conn, err := net.Dial("tcp", address)
	if err != nil {
		return nil, err
	}
	sc := &RaftSimpleClient{
		mu:              &sync.Mutex{},
		conn:            conn,
		writer:          bufio.NewWriterSize(conn, defaultBufferSize),
		reader:          bufio.NewReaderSize(conn, defaultBufferSize),
		responseChan:    make(chan []byte, 10),
		transactionChan: make(chan *ProducerTransaction),
		exitChan:        make(chan struct{}),
	}
	go sc.handleSend()
	go sc.handleRecv()
	return sc, nil
}