Use ByteArrayOutputStream in MockSocket instead of StringWriter