@@ -96,7 +96,7 @@ func (this *ChunkReader) Read() (*alloc.Buffer, error) {
log.Debug("AuthenticationReader: Unexpected auth: ", authBytes)
return nil, transport.ErrCorruptedPacket
}
- buffer.Value = payload
+ buffer.SliceFrom(AuthSize)
return buffer, nil
@@ -18,4 +18,7 @@ func TestNormalChunkReading(t *testing.T) {
payload, err := reader.Read()
assert.Error(err).IsNil()
assert.Bytes(payload.Value).Equals([]byte{11, 12, 13, 14, 15, 16, 17, 18})
+
+ payload.PrependBytes(3, 4)
+ assert.Bytes(payload.Value).Equals([]byte{3, 4, 11, 12, 13, 14, 15, 16, 17, 18})