How to make protocols for Java sockets?

Hello all,
when sending data it's often necessary to inform the server about what kind of data he gets so that he can react accordingly. To achieve that, I need control messages that I can append to any message. That works pretty easy when sending strings, but I don't know how I could tell the server that he will receive a serialized object, because I can't append a string at the beginning of an OutputStream. It would be very nice if someone could help me here.