mirror of https://bitbucket.org/ausocean/av.git
31 lines
559 B
Go
31 lines
559 B
Go
package rtcp
|
|
|
|
import (
|
|
"net"
|
|
"testing"
|
|
)
|
|
|
|
func TestReceiveAndSend(t *testing.T) {
|
|
quit := make(chan struct{})
|
|
go testServer(quit)
|
|
}
|
|
|
|
func testServer(quit chan struct{}, t *testing.T) {
|
|
const testServerAddr = "localhost:8000"
|
|
sAddr, err := net.ResolveUDPAddr("udp", testServerAddr)
|
|
if err != nil {
|
|
t.Fatalf("could not resolve test server address, failed with error: %v", err)
|
|
}
|
|
|
|
conn, err := net.DialUDP("udp", nil, sAddr)
|
|
if err != nil {
|
|
t.Fatalf("could not dial, failed with error: %v", err)
|
|
}
|
|
|
|
select {
|
|
case <-quit:
|
|
return
|
|
default:
|
|
}
|
|
}
|