java.io.StreamCorruptedException: invalid stream header: 54657374
java.io.StreamCorruptedException: invalid stream header: 54657374
Clearly you arent sending the data with ObjectOutputStream:
you are just writing the bytes.
- If you read with
readObject()
you must write withwriteObject().
- If you read with
readUTF()
you must write withwriteUTF().
- If you read with
readXXX()
you must write withwriteXXX(),
for most values of XXX.
You cant expect ObjectInputStream
to automagically convert text into objects. The hexadecimal 54657374
is Test
as text. You must be sending it directly as bytes.