diff --git a/e2e-grpc/src/test/scala/ProtoInputStreamSpec.scala b/e2e-grpc/src/test/scala/ProtoInputStreamSpec.scala index 56c2d4ff0..460373fb1 100644 --- a/e2e-grpc/src/test/scala/ProtoInputStreamSpec.scala +++ b/e2e-grpc/src/test/scala/ProtoInputStreamSpec.scala @@ -73,12 +73,13 @@ class ProtoInputStreamSpec extends AnyFunSpec with Matchers { var count = 0 var buf = newBuffer val res = Array.newBuilder[Byte] - do { + while({ res ++= buf.slice(offset, offset + count) buf = newBuffer offset += count count = stream.read(buf, offset, Random.nextInt(3)) - } while (count !== -1) + count !== -1 + }) {} res.result() must be(message.toByteArray) }