Protocol { static void writeArray(RedisOutputStream stream, int length) throws IOException { stream.write(ARRAY_BYTE); stream.writeBytesCRLF(RedisEncodings.encode(length)); }    }
@Test void writeArray() throws IOException { var stream = new ByteArrayOutputStream(); var outputStream = new RedisOutputStream(stream, 8192); Protocol.writeArray(outputStream, 3); outputStream.flush(); assertThat(decode(stream.toByteArray())).isEqualTo("*3\r\n"); }