mirror of
https://github.com/bluenviron/mediamtx
synced 2025-02-11 00:48:48 +00:00
* rtmp: improve MsgCommandAMF0 * rtmp: fix MsgSetPeerBandwidth * rtmp: add message tests * rtmp: replace implementation with new one * rtmp: rename handshake functions * rtmp: avoid calling useless function * rtmp: use time.Duration for PTSDelta * rtmp: fix decoding chunks with relevant size * rtmp: rewrite implementation of rtmp connection * rtmp: fix tests * rtmp: improve error message * rtmp: replace h264 config implementation * link against github.com/notedit/rtmp * normalize MessageStreamID * rtmp: make acknowledge optional * rtmp: fix decoding of chunk2 + chunk3 * avoid using encoding/binary
37 lines
568 B
Go
37 lines
568 B
Go
package handshake
|
|
|
|
import (
|
|
"net"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestHandshake(t *testing.T) {
|
|
ln, err := net.Listen("tcp", "127.0.0.1:9122")
|
|
require.NoError(t, err)
|
|
defer ln.Close()
|
|
|
|
done := make(chan struct{})
|
|
|
|
go func() {
|
|
conn, err := ln.Accept()
|
|
require.NoError(t, err)
|
|
defer conn.Close()
|
|
|
|
err = DoServer(conn, true)
|
|
require.NoError(t, err)
|
|
|
|
close(done)
|
|
}()
|
|
|
|
conn, err := net.Dial("tcp", "127.0.0.1:9122")
|
|
require.NoError(t, err)
|
|
defer conn.Close()
|
|
|
|
err = DoClient(conn, true)
|
|
require.NoError(t, err)
|
|
|
|
<-done
|
|
}
|