public static void WriteHandshakeFrame(this ConnectionStates.ConnectionState state, int contentSize, BufferExtensions.ContentWriter content, HandshakeType handshakeType) { var writer = new WriterWrapper(state.Connection.HandshakeOutput.Writer.Alloc(), state.HandshakeHash); writer.WriteBigEndian(handshakeType); writer.WriteBigEndian((UInt24)contentSize); content(ref writer); Debug.Assert((writer.BytesWritten - 4) == contentSize); writer.Commit(); }