Пример #1
0
func TestItWritesVersion(t *testing.T) {
	buf := new(bytes.Buffer)
	v := handshake.NewVersionSequence()

	assert.Nil(t, v.WriteTo(buf))
	assert.Equal(t, []byte{0x3}, buf.Bytes()[:1])
}
Пример #2
0
func TestItReadsSupportedVersionNumbers(t *testing.T) {
	v := handshake.NewVersionSequence()
	err := v.Read(bytes.NewBuffer([]byte{0x3}))

	assert.Nil(t, err)
}
Пример #3
0
func TestItRejectsUnsupportedVersionNumbers(t *testing.T) {
	v := handshake.NewVersionSequence()
	err := v.Read(bytes.NewBuffer([]byte{0x4}))

	assert.Equal(t, "rtmp/handshake: unsupported version 4", err.Error())
}
Пример #4
0
func TestItConstructsVersionSequences(t *testing.T) {
	v := handshake.NewVersionSequence()

	assert.IsType(t, new(handshake.VerisonSequence), v)
}