Added test for writing to a buffer and reading the data back again.