func (r *recorder) Read(b []byte) (n int, err error) {
	if r.Conn != nil {
		numRead, err := r.Conn.Read(b)
		if numRead > 0 {
			r.record(b[:numRead], false)
		}
		if err != nil {
			r.recordErr(err, false)
		}
		return numRead, err
	}
	if r.currentEvent >= len(r.events) {
		return 0, errors.New("Trying to read past all of the events in the recorder! %#v", r)
	}
	event := r.events[r.currentEvent]
	if event.IsWrite {
		return 0, errors.New("Recorder expected Read, got Write! %#v, Event: %#v", r, event)
	}
	for i := 0; i < len(b); i++ {
		if len(event.Event) == 0 {
			return i, errors.New("Attempted to read past current event in recorder! Bytes: %s. Recorder %#v, Event; %#v", b, r, event)
		}
		b[i] = event.Event[0]
		event.Event = event.Event[1:]
	}
	if len(event.Event) == 0 {
		r.currentEvent++
	}
	return len(b), nil
}
Read from the net conn, recording the interaction
package golangNeo4jBoltDriver
import (
	"bytes"
	"encoding/json"
	"fmt"
	"net"
	"os"
	"time"
	"github.com/johnnadratowski/golang-neo4j-bolt-driver/encoding"
	"github.com/johnnadratowski/golang-neo4j-bolt-driver/errors"
	"github.com/johnnadratowski/golang-neo4j-bolt-driver/log"
)
type recorder struct {
	net.Conn
	name         string
	events       []*Event
	connStr      string
	currentEvent int
}
func newRecorder(name string, connStr string) *recorder {
	r := &recorder{
		name:    name,
		connStr: connStr,
	}
	if r.connStr == "" {
		if err := r.load(r.name); err != nil {
			log.Fatalf("Couldn't load data from recording files!: %s", err)
		}
	}
	return r
}
func (r *recorder) completedLast() bool {
	event := r.lastEvent()
	if event == nil {
		return true
	}
	return event.Completed
}
func (r *recorder) lastEvent() *Event {
	if len(r.events) > 0 {
		return r.events[len(r.events)-1]
	}
	return nil
}