To send the byte parameters correctly (different amounts of data are being returned getEncoded(), the size must be sent first since 0xff (-1) terminates reads without knowing the size. This was a huge pain since it must convert back and forth between a 4-byte byte array and a 4-byte integer.