Exemplo n.º 1
0
func TestChunkersMarshalChunks(t *testing.T) {
	crsp := &conn.ConnectResponse{
		TransactionId: 12,
		Properties:    amf0.Object{amf0.NewPaired()},
		Information:   amf0.Object{amf0.NewPaired()},
	}

	marshalled, _ := crsp.Marshal()

	c, err := conn.NewChunker(13).Chunk(crsp)

	assert.Nil(t, err)
	assert.Equal(t, conn.ChunkStreamId, c.Header.BasicHeader.StreamId)
	assert.Equal(t, byte(0x14), c.Header.MessageHeader.TypeId)
	assert.Equal(t, uint32(len(marshalled)), c.Header.MessageHeader.Length)
	assert.Equal(t, marshalled, c.Data)
}
Exemplo n.º 2
0
func TestNewChunkerReturnsNewChunkers(t *testing.T) {
	c := conn.NewChunker(0)

	assert.IsType(t, &conn.DefaultChunker{}, c)
}