-
Notifications
You must be signed in to change notification settings - Fork 41
/
utilconn_test.go
36 lines (34 loc) · 1.01 KB
/
utilconn_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package canopus
import "testing"
func TestSendMessages(t *testing.T) {
//var conn Connection
//var s CoapServer
//_, err := SendMessageTo(s, nil, conn, nil)
//assert.NotNil(t, err)
//assert.Equal(t, ErrNilConn, err)
//
//conn = NewUDPConnection(nil)
//SendMessageTo(s, nil, conn, nil)
//_, err = SendMessageTo(s, nil, conn, nil)
//assert.NotNil(t, err)
//assert.Equal(t, ErrNilMessage, err)
//
//_, err = SendMessageTo(s, NewEmptyMessage(12345), conn, nil)
//assert.NotNil(t, err)
//assert.Equal(t, ErrNilAddr, err)
//
//addr := &net.UDPAddr{}
//conn = NewMockCanopusUDPConnection(CoapCodeCreated, false, false)
//msg := NewBasicConfirmableMessage()
//_, err = SendMessageTo(s, msg, conn, addr)
//assert.Nil(t, err)
//
//msg.MessageType = MessageNonConfirmable
//_, err = SendMessageTo(s, msg, conn, addr)
//assert.Nil(t, err)
//
//conn = NewMockCanopusUDPConnection(CoapCodeCreated, false, true)
//msg.MessageType = MessageConfirmable
//_, err = SendMessageTo(s, msg, conn, addr)
//assert.NotNil(t, err)
}