func TestManagerWithoutTransports(t *testing.T) {
	assert := assert.New(t)

	var (
		c   = Config{}
		tr  transports.Transport
		err error
	)

	tr, err = c.Open()
	if assert.NoError(err) && assert.NotNil(tr) {

		err = tr.Close()
		assert.NoError(err)
	}
}
func TestManagerWithOneTransport(t *testing.T) {
	assert := assert.New(t)

	var (
		c   = Config{udp.Config{}}
		tr  transports.Transport
		err error
	)

	tr, err = c.Open()
	if assert.NoError(err) && assert.NotNil(tr) {
		t.Logf("addrs=%v", tr.Addrs())

		err = tr.Close()
		assert.NoError(err)
	}
}
Beispiel #3
0
func (t *transport) runAccepter(s transports.Transport) {
	defer t.wg.Done()
	for {
		conn, err := s.Accept()
		if err == io.EOF {
			break
		}
		if neterr, ok := err.(net.Error); ok && neterr.Temporary() {
			time.Sleep(100 * time.Millisecond)
			continue
		}
		if err != nil {
			return
		}

		t.cAccept <- conn
	}
}