upload_queue_test.go 376 B

12345678910111213141516171819202122
  1. package splithttp_test
  2. import (
  3. "testing"
  4. "github.com/xtls/xray-core/common"
  5. . "github.com/xtls/xray-core/transport/internet/splithttp"
  6. )
  7. func Test_regression_readzero(t *testing.T) {
  8. q := NewUploadQueue(10)
  9. q.Push(Packet{
  10. Payload: []byte("x"),
  11. Seq: 0,
  12. })
  13. buf := make([]byte, 20)
  14. n, err := q.Read(buf)
  15. common.Must(err)
  16. if n != 1 {
  17. t.Error("n=", n)
  18. }
  19. }