|
@@ -6,9 +6,15 @@ import (
|
|
|
"io"
|
|
|
"net"
|
|
|
"strconv"
|
|
|
- "testing"
|
|
|
)
|
|
|
|
|
|
+
|
|
|
+type TestState interface {
|
|
|
+ Error(args ...interface{})
|
|
|
+ Fatal(args ...interface{})
|
|
|
+ Fatalf(format string, args ...interface{})
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -25,7 +31,7 @@ type MockBroker struct {
|
|
|
stopper chan bool
|
|
|
expectations chan encoder
|
|
|
listener net.Listener
|
|
|
- t *testing.T
|
|
|
+ t TestState
|
|
|
expecting encoder
|
|
|
}
|
|
|
|
|
@@ -118,10 +124,10 @@ func (b *MockBroker) serverError(err error, conn net.Conn) bool {
|
|
|
return false
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
-
|
|
|
-func NewMockBroker(t *testing.T, brokerID int) *MockBroker {
|
|
|
+
|
|
|
+func NewMockBroker(t TestState, brokerID int) *MockBroker {
|
|
|
var err error
|
|
|
|
|
|
broker := &MockBroker{
|