+
+ var receivedBytes []byte
+ done := false
+ for !done {
+ line, err := rcv.ReadBytes('\n')
+ if err != nil {
+ t.Fatal(err)
+ }
+ if len(line) >= 5 && string(line[0:5]) == "[...]" {
+ if receivedBytes == nil {
+ t.Fatal("Beginning of line reported as continuation")
+ }
+ line = line[5:]
+ }
+ if len(line) >= 6 && string(line[len(line)-6:len(line)]) == "[...]\n" {
+ line = line[:len(line)-6]
+ } else {
+ done = true
+ }
+ receivedBytes = append(receivedBytes, line...)