func (s deviceSet) registryCapture() func(*device) {
	return func(d *device) {
		s[d] = true
	}
}
registryCapture returns a low-level visitor for registry testing
package device
import (
	"errors"
	"net/http"
	"net/http/httptest"
	"testing"
	"time"
	"github.com/gorilla/websocket"
	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/mock"
)
type mockReader struct {
	mock.Mock
}
func (m *mockReader) Read(b []byte) (int, error) {
	arguments := m.Called(b)
	return arguments.Int(0), arguments.Error(1)
}
type mockConnectionReader struct {
	mock.Mock
}
func (m *mockConnectionReader) ReadMessage() (int, []byte, error) {
	arguments := m.Called()
	return arguments.Int(0), arguments.Get(1).([]byte), arguments.Error(2)
}
func (m *mockConnectionReader) SetReadDeadline(d time.Time) error {
	return m.Called(d).Error(0)
}
func (m *mockConnectionReader) SetPongHandler(h func(string) error) {
	m.Called(h)
}
func (m *mockConnectionReader) Close() error {
	return m.Called().Error(0)
}
type mockConnectionWriter struct {
	mock.Mock
}
func (m *mockConnectionWriter) WriteMessage(messageType int, data []byte) error {
	return m.Called(messageType, data).Error(0)
}
func (m *mockConnectionWriter) WritePreparedMessage(pm *websocket.PreparedMessage) error {
	return m.Called(pm).Error(0)
}
func (m *mockConnectionWriter) SetWriteDeadline(d time.Time) error {
	return m.Called(d).Error(0)
}
func (m *mockConnectionWriter) Close() error {
	return m.Called().Error(0)
}
type mockDialer struct {
	mock.Mock
}
func (m *mockDialer) DialDevice(deviceName, url string, extra http.Header) (*websocket.Conn, *http.Response, error) {
	var (
		arguments = m.Called(deviceName, url, extra)
		first, _  = arguments.Get(0).(*websocket.Conn)
		second, _ = arguments.Get(1).(*http.Response)
	)
	return first, second, arguments.Error(2)
}
type mockWebsocketDialer struct {
	mock.Mock
}
func (m *mockWebsocketDialer) Dial(url string, requestHeader http.Header) (*websocket.Conn, *http.Response, error) {
	var (
		arguments = m.Called(url, requestHeader)
		first, _  = arguments.Get(0).(*websocket.Conn)
		second, _ = arguments.Get(1).(*http.Response)
	)
	return first, second, arguments.Error(2)
}
type deviceSet map[*device]bool
func (s deviceSet) len() int {
	return len(s)
}
func (s deviceSet) add(d Interface) {
	s[d.(*device)] = true
}
func (s *deviceSet) reset() {
	*s = make(deviceSet)
}
func (s deviceSet) managerCapture() func(Interface) bool {
	return func(d Interface) bool {
		s.add(d)
		return true
	}
}