Implement StreamWriter/Reader writeTag and readTag methods
The current implementation of the
StreamEncrypter write a tag, which allows the recipient to identify the connection. This tag is written automatically when the first message is written (or the stream is flushed).
Writing this tag explicitly before sending any message simplifies the implementation of mailbox session management. A public
writeTag method should be added to the 'StreamWriter'/'StreamEncrypter'.
readTag method, which is currently part of the
ConnectionManager, is also required to manage mailbox connections. To avoid redundancy we could add a StreamReader interface and implement a
readTag function ('StreamReader' currently extends an
As @akwizgran suggested, a workaround is to simply flush the
StreamWriter, but this also writes an empty frame.