How does it do all this?
All messages start with that sequence.
If you lose "lock" on the stream, it skips until it matches that sequence.
It then reads the
standard message from the stream.
int32 magic (already read)
char[12] command
int32 length
int32 checksum
char[length] data
It then runs a sha hash on the data and makes sure it matches the checksum.
This gives a one in 4 billion chance that random data would be detected as a message.
Your data would need to have the magic pattern and then the checksum would match (so actually 4 billion * 4 billion).
Creating a message would be easier though. However, it only matters if the TCP connection loses lock. This should only happen for bugged (and some old) clients.
All new clients have that structure for all their packets.