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]) }
func TestItReadsSupportedVersionNumbers(t *testing.T) { v := handshake.NewVersionSequence() err := v.Read(bytes.NewBuffer([]byte{0x3})) assert.Nil(t, err) }
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()) }
func TestItConstructsVersionSequences(t *testing.T) { v := handshake.NewVersionSequence() assert.IsType(t, new(handshake.VerisonSequence), v) }