Ejemplo n.º 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])
}
Ejemplo n.º 2
0
func TestItReadsSupportedVersionNumbers(t *testing.T) {
	v := handshake.NewVersionSequence()
	err := v.Read(bytes.NewBuffer([]byte{0x3}))

	assert.Nil(t, err)
}
Ejemplo n.º 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())
}
Ejemplo n.º 4
0
func TestItConstructsVersionSequences(t *testing.T) {
	v := handshake.NewVersionSequence()

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