2022-10-12 11:55:36 +08:00
|
|
|
package hpds_node
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestAccessPointSendDataToServer(t *testing.T) {
|
|
|
|
ap := NewAccessPoint("test-ap")
|
2023-04-05 17:25:22 +08:00
|
|
|
defer func() {
|
|
|
|
_ = ap.Close()
|
|
|
|
}()
|
2022-10-12 11:55:36 +08:00
|
|
|
|
|
|
|
// connect to server
|
|
|
|
err := ap.Connect()
|
|
|
|
assert.Nil(t, err)
|
|
|
|
|
|
|
|
// send data to server
|
|
|
|
n, err := ap.Write([]byte("test"))
|
|
|
|
assert.Greater(t, n, 0, "[ap.Write] expected n > 0, but got %d", n)
|
|
|
|
assert.Nil(t, err)
|
|
|
|
}
|