You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2009/10/02 17:19:22 UTC

svn commit: r821052 - in /activemq/activemq-dotnet/Apache.NMS/trunk/src: main/csharp/IBytesMessage.cs main/csharp/IMessage.cs test/csharp/BytesMessageTest.cs

Author: tabish
Date: Fri Oct  2 15:19:22 2009
New Revision: 821052

URL: http://svn.apache.org/viewvc?rev=821052&view=rev
Log:
https://issues.apache.org/activemq/browse/AMQNET-162

Updated IMessage and IBytesMessage interfaces added a bit more testing to the BytesMessage Test.

Modified:
    activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/IBytesMessage.cs
    activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/IMessage.cs
    activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/BytesMessageTest.cs

Modified: activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/IBytesMessage.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/IBytesMessage.cs?rev=821052&r1=821051&r2=821052&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/IBytesMessage.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/IBytesMessage.cs Fri Oct  2 15:19:22 2009
@@ -17,11 +17,470 @@
 namespace Apache.NMS
 {
 	/// <summary>
-	/// Represents a binary based message
+    ///
+	/// A BytesMessage object is used to send a message containing a stream of uninterpreted
+    /// bytes. It inherits from the Message interface and adds a bytes message body. The 
+    /// receiver of the message supplies the interpretation of the bytes.
+    ///
+    /// This message type is for client encoding of existing message formats. If possible, 
+    /// one of the other self-defining message types should be used instead.
+    ///
+    /// Although the NMS API allows the use of message properties with byte messages, they 
+    /// are typically not used, since the inclusion of properties may affect the format.
+    /// 
+    /// When the message is first created, and when ClearBody is called, the body of the 
+    /// message is in write-only mode. After the first call to Reset has been made, the 
+    /// message body is in read-only mode. After a message has been sent, the client that 
+    /// sent it can retain and modify it without affecting the message that has been sent. 
+    /// The same message object can be sent multiple times. When a message has been received, 
+    /// the provider has called Reset so that the message body is in read-only mode for the 
+    /// client.
+    /// 
+    /// If ClearBody is called on a message in read-only mode, the message body is cleared and 
+    /// the message is in write-only mode.
+    /// 
+    /// If a client attempts to read a message in write-only mode, a MessageNotReadableException 
+    /// is thrown.
+    /// 
+    /// If a client attempts to write a message in read-only mode, a MessageNotWriteableException 
+    /// is thrown. 
 	/// </summary>
 	public interface IBytesMessage : IMessage
 	{
 		byte[] Content { get; set; }
+        
+        /// <value>
+        /// Gets the number of bytes of the message body when the message is in read-only mode. 
+        /// The value returned can be used to allocate a byte array. The value returned is the
+        /// entire length of the message body, regardless of where the pointer for reading the 
+        /// message is currently located.
+        /// </value>
+        /// <exception cref="Apache.NMS.MessageNotReadableException">
+        /// Thrown when the Message is in write-only mode.
+        /// </exception>        
+        /// <exception cref="Apache.NMS.NMSException">
+        /// Thrown when there is an unhandled exception thrown from the provider.
+        /// </exception>  
+        long BodyLength { get; }
+        
+        /// <summary>
+        /// Reads a byte from the Message Stream.
+        /// </summary>
+        /// <returns>
+        /// A <see cref="System.Byte"/>
+        /// </returns>
+        /// <exception cref="Apache.NMS.MessageNotReadableException">
+        /// Thrown when the Message is in write-only mode.
+        /// </exception>        
+        /// <exception cref="Apache.NMS.MessageEOFException">
+        /// Thrown when an unexpected end of bytes has been reached.
+        /// </exception>
+        /// <exception cref="Apache.NMS.NMSException">
+        /// Thrown when there is an unhandled exception thrown from the provider.
+        /// </exception>  
+        byte ReadByte();
+        
+        /// <summary>
+        /// Writes a byte to the Message stream.
+        /// </summary>
+        /// <param name="value">
+        /// A <see cref="System.Byte"/>
+        /// </param>
+        /// <exception cref="Apache.NMS.MessageNotWriteableException">
+        /// Thrown when the Message is in read-only mode.
+        /// </exception>        
+        /// <exception cref="Apache.NMS.NMSException">
+        /// Thrown when there is an unhandled exception thrown from the provider.
+        /// </exception>  
+        void WriteByte( byte value );
+        
+        /// <summary>
+        /// Reads a boolean from the Message Stream.
+        /// </summary>
+        /// <returns>
+        /// A <see cref="System.Boolean"/>
+        /// </returns>
+        /// <exception cref="Apache.NMS.MessageNotReadableException">
+        /// Thrown when the Message is in write-only mode.
+        /// </exception>        
+        /// <exception cref="Apache.NMS.MessageEOFException">
+        /// Thrown when an unexpected end of bytes has been reached.
+        /// </exception>        
+        /// <exception cref="Apache.NMS.NMSException">
+        /// Thrown when there is an unhandled exception thrown from the provider.
+        /// </exception>  
+        bool ReadBoolean();
+
+        /// <summary>
+        /// Write a one byte value to the message stream representing the boolean
+        /// value passed.
+        /// </summary>
+        /// <param name="value">
+        /// A <see cref="System.Boolean"/>
+        /// </param>
+        /// <exception cref="Apache.NMS.MessageNotWriteableException">
+        /// Thrown when the Message is in read-only mode.
+        /// </exception>        
+        /// <exception cref="Apache.NMS.NMSException">
+        /// Thrown when there is an unhandled exception thrown from the provider.
+        /// </exception>  
+        void WriteBoolean( bool value );
+        
+        /// <summary>
+        /// Reads a char from the Message Stream.
+        /// </summary>
+        /// <returns>
+        /// A <see cref="System.Char"/>
+        /// </returns>
+        /// <exception cref="Apache.NMS.MessageNotReadableException">
+        /// Thrown when the Message is in write-only mode.
+        /// </exception>        
+        /// <exception cref="Apache.NMS.MessageEOFException">
+        /// Thrown when an unexpected end of bytes has been reached.
+        /// </exception>   
+        /// <exception cref="Apache.NMS.NMSException">
+        /// Thrown when there is an unhandled exception thrown from the provider.
+        /// </exception>  
+        char ReadChar();
+
+        /// <summary>
+        /// Write a two byte value to the message stream representing the character
+        /// value passed.  High byte first.
+        /// </summary>
+        /// <param name="value">
+        /// A <see cref="System.Char"/>
+        /// </param>
+        /// <exception cref="Apache.NMS.MessageNotWriteableException">
+        /// Thrown when the Message is in read-only mode.
+        /// </exception>             
+        /// <exception cref="Apache.NMS.NMSException">
+        /// Thrown when there is an unhandled exception thrown from the provider.
+        /// </exception>  
+        void WriteChar( char value );
+
+        /// <summary>
+        /// Reads a Short from the Message Stream.
+        /// </summary>
+        /// <returns>
+        /// A <see cref="System.Int16"/>
+        /// </returns>
+        /// <exception cref="Apache.NMS.MessageNotReadableException">
+        /// Thrown when the Message is in write-only mode.
+        /// </exception>        
+        /// <exception cref="Apache.NMS.MessageEOFException">
+        /// Thrown when an unexpected end of bytes has been reached.
+        /// </exception>           
+        /// <exception cref="Apache.NMS.NMSException">
+        /// Thrown when there is an unhandled exception thrown from the provider.
+        /// </exception>  
+        short ReadInt16();
+
+        /// <summary>
+        /// Write a two byte value to the message stream representing the short
+        /// value passed.  High byte first.
+        /// </summary>
+        /// <param name="value">
+        /// A <see cref="System.Int16"/>
+        /// </param>
+        /// <exception cref="Apache.NMS.MessageNotWriteableException">
+        /// Thrown when the Message is in read-only mode.
+        /// </exception>          
+        /// <exception cref="Apache.NMS.NMSException">
+        /// Thrown when there is an unhandled exception thrown from the provider.
+        /// </exception>  
+        void WriteInt16( short value );
+        
+        /// <summary>
+        /// Reads an int from the Message Stream.
+        /// </summary>
+        /// <returns>
+        /// A <see cref="System.Int32"/>
+        /// </returns>
+        /// <exception cref="Apache.NMS.MessageNotReadableException">
+        /// Thrown when the Message is in write-only mode.
+        /// </exception>        
+        /// <exception cref="Apache.NMS.MessageEOFException">
+        /// Thrown when an unexpected end of bytes has been reached.
+        /// </exception>           
+        /// <exception cref="Apache.NMS.NMSException">
+        /// Thrown when there is an unhandled exception thrown from the provider.
+        /// </exception>  
+        int ReadInt32();
+        
+        /// <summary>
+        /// Write a four byte value to the message stream representing the integer
+        /// value passed.  High byte first.
+        /// </summary>
+        /// <param name="value">
+        /// A <see cref="System.Int32"/>
+        /// </param>
+        /// <exception cref="Apache.NMS.MessageNotWriteableException">
+        /// Thrown when the Message is in read-only mode.
+        /// </exception>         
+        /// <exception cref="Apache.NMS.NMSException">
+        /// Thrown when there is an unhandled exception thrown from the provider.
+        /// </exception>  
+        void WriteInt32( int value );
+        
+        /// <summary>
+        /// Reads a long from the Message Stream.
+        /// </summary>
+        /// <returns>
+        /// A <see cref="System.Int64"/>
+        /// </returns>
+        /// <exception cref="Apache.NMS.MessageNotReadableException">
+        /// Thrown when the Message is in write-only mode.
+        /// </exception>        
+        /// <exception cref="Apache.NMS.MessageEOFException">
+        /// Thrown when an unexpected end of bytes has been reached.
+        /// </exception>           
+        /// <exception cref="Apache.NMS.NMSException">
+        /// Thrown when there is an unhandled exception thrown from the provider.
+        /// </exception>  
+        long ReadInt64();
+        
+        /// <summary>
+        /// Write a eight byte value to the message stream representing the long
+        /// value passed.  High byte first.
+        /// </summary>
+        /// <param name="value">
+        /// A <see cref="System.Int64"/>
+        /// </param>
+        /// <exception cref="Apache.NMS.MessageNotWriteableException">
+        /// Thrown when the Message is in read-only mode.
+        /// </exception>          
+        /// <exception cref="Apache.NMS.NMSException">
+        /// Thrown when there is an unhandled exception thrown from the provider.
+        /// </exception>  
+        void WriteInt64( long value );
+        
+        /// <summary>
+        /// Reads a float from the Message Stream.
+        /// </summary>
+        /// <returns>
+        /// A <see cref="System.Single"/>
+        /// </returns>
+        /// <exception cref="Apache.NMS.MessageNotReadableException">
+        /// Thrown when the Message is in write-only mode.
+        /// </exception>        
+        /// <exception cref="Apache.NMS.MessageEOFException">
+        /// Thrown when an unexpected end of bytes has been reached.
+        /// </exception>           
+        /// <exception cref="Apache.NMS.NMSException">
+        /// Thrown when there is an unhandled exception thrown from the provider.
+        /// </exception>  
+        float ReadSingle();
+        
+        /// <summary>
+        /// Write a four byte value to the message stream representing the float
+        /// value passed.  High byte first.
+        /// </summary>
+        /// <param name="value">
+        /// A <see cref="System.Single"/>
+        /// </param>
+        /// <exception cref="Apache.NMS.MessageNotWriteableException">
+        /// Thrown when the Message is in read-only mode.
+        /// </exception>          
+        /// <exception cref="Apache.NMS.NMSException">
+        /// Thrown when there is an unhandled exception thrown from the provider.
+        /// </exception>  
+        void WriteSingle( float value );
+        
+        /// <summary>
+        /// Reads an double from the Message Stream.
+        /// </summary>
+        /// <returns>
+        /// A <see cref="System.Double"/>
+        /// </returns>
+        /// <exception cref="Apache.NMS.MessageNotReadableException">
+        /// Thrown when the Message is in write-only mode.
+        /// </exception>        
+        /// <exception cref="Apache.NMS.MessageEOFException">
+        /// Thrown when an unexpected end of bytes has been reached.
+        /// </exception>           
+        /// <exception cref="Apache.NMS.NMSException">
+        /// Thrown when there is an unhandled exception thrown from the provider.
+        /// </exception>  
+        double ReadDouble();
+        
+        /// <summary>
+        /// Write a eight byte value to the message stream representing the double
+        /// value passed.  High byte first.
+        /// </summary>
+        /// <param name="value">
+        /// A <see cref="System.Double"/>
+        /// </param>
+        /// <exception cref="Apache.NMS.MessageNotWriteableException">
+        /// Thrown when the Message is in read-only mode.
+        /// </exception>          
+        /// <exception cref="Apache.NMS.NMSException">
+        /// Thrown when there is an unhandled exception thrown from the provider.
+        /// </exception>  
+        void WriteDouble( double value );
+        
+        /// <summary>
+        /// Reads a byte array from the bytes message stream.
+        /// 
+        /// If the length of array value is less than the number of bytes remaining to 
+        /// be read from the stream, the array should be filled. A subsequent call reads
+        /// the next increment, and so on.
+        /// 
+        /// If the number of bytes remaining in the stream is less than the length of array 
+        /// value, the bytes should be read into the array. The return value of the total number
+        /// of bytes read will be less than the length of the array, indicating that there are 
+        /// no more bytes left to be read from the stream. The next read of the stream returns -1.
+        /// </summary>
+        /// <param name="value">
+        /// The byte array that will be used as a buffer to read into.
+        /// </param>
+        /// <returns>
+        /// A <see cref="System.Int32"/>
+        /// The number of bytes read into the passed byte array, or -1 if there are no more
+        /// bytes left to be read from the stream.
+        /// </returns>
+        /// <exception cref="Apache.NMS.NMSException">
+        /// Thrown when there is an unhandled exception thrown from the provider.
+        /// </exception>  
+        /// <exception cref="Apache.NMS.MessageNotReadableException">
+        /// Thrown when the Message is in write-only mode.
+        /// </exception>        
+        int ReadBytes( byte[] value );
+        
+        /// <summary>
+        /// Reads a portion of the bytes message stream.
+        /// 
+        /// If the length of array value is less than the number of bytes remaining to be 
+        /// read from the stream, the array should be filled. A subsequent call reads the 
+        /// next increment, and so on.
+        /// 
+        /// If the number of bytes remaining in the stream is less than the length of array 
+        /// value, the bytes should be read into the array. The return value of the total 
+        /// number of bytes read will be less than the length of the array, indicating that 
+        /// there are no more bytes left to be read from the stream. The next read of the 
+        /// stream returns -1.
+        /// 
+        /// If length is negative, or length is greater than the length of the array value,
+        /// then an Exception is thrown. No bytes will be read from the stream for this
+        /// exception case.
+        /// </summary>
+        /// <param name="value">
+        /// The byte array that will be used as a buffer to read into.
+        /// </param>
+        /// <param name="length">
+        /// The amount of bytes to read into the buffer.
+        /// </param>
+        /// <returns>
+        /// A <see cref="System.Int32"/>
+        /// The number of bytes read into the passed byte array, or -1 if there are no more
+        /// bytes left to be read from the stream.
+        /// </returns>
+        /// <exception cref="Apache.NMS.MessageNotReadableException">
+        /// Thrown when the Message is in write-only mode.
+        /// </exception>                
+        /// <exception cref="Apache.NMS.NMSException">
+        /// Thrown when there is an unhandled exception thrown from the provider.
+        /// </exception>  
+        int ReadBytes( byte[] value, int length );
+        
+        /// <summary>
+        /// Writes a byte array to the bytes message stream.
+        /// </summary>
+        /// <param name="value">
+        /// A <see cref="System.Byte"/>
+        /// </param>
+        /// <exception cref="Apache.NMS.MessageNotWriteableException">
+        /// Thrown when the Message is in read-only mode.
+        /// </exception>          
+        /// <exception cref="Apache.NMS.NMSException">
+        /// Thrown when there is an unhandled exception thrown from the provider.
+        /// </exception>  
+        void WriteBytes( byte[] value );
+
+        /// <summary>
+        /// Writes a portion of a byte array to the bytes message stream.
+        /// </summary>
+        /// <param name="value">
+        /// A <see cref="System.Byte"/>
+        /// </param>
+        /// <param name="offset">
+        /// A <see cref="System.Int32"/>
+        /// </param>
+        /// <param name="length">
+        /// A <see cref="System.Int32"/>
+        /// </param>
+        /// <exception cref="Apache.NMS.MessageNotWriteableException">
+        /// Thrown when the Message is in read-only mode.
+        /// </exception>          
+        /// <exception cref="Apache.NMS.NMSException">
+        /// Thrown when there is an unhandled exception thrown from the provider.
+        /// </exception>  
+        void WriteBytes( byte[] value, int offset, int length );
+        
+        /// <summary>
+        /// Reads a string that has been encoded using a modified UTF-8 format from the bytes
+        /// message stream.
+        /// </summary>
+        /// <returns>
+        /// A <see cref="System.String"/>
+        /// </returns>
+        /// <exception cref="Apache.NMS.MessageNotReadableException">
+        /// Thrown when the Message is in write-only mode.
+        /// </exception>        
+        /// <exception cref="Apache.NMS.MessageEOFException">
+        /// Thrown when an unexpected end of bytes has been reached.
+        /// </exception>           
+        /// <exception cref="Apache.NMS.NMSException">
+        /// Thrown when there is an unhandled exception thrown from the provider.
+        /// </exception>  
+        string ReadString();
+        
+        /// <summary>
+        /// Writes a string to the bytes message stream using UTF-8 encoding in a 
+        /// machine-independent manner. 
+        /// </summary>
+        /// <param name="value">
+        /// A <see cref="System.String"/>
+        /// </param>
+        /// <exception cref="Apache.NMS.MessageNotWriteableException">
+        /// Thrown when the Message is in read-only mode.
+        /// </exception>   
+        /// <exception cref="Apache.NMS.NMSException">
+        /// Thrown when there is an unhandled exception thrown from the provider.
+        /// </exception>  
+        void WriteString( string value );
+        
+        /// <summary>
+        /// Writes an object to the bytes message stream.
+        /// 
+        /// This method works only for the objectified primitive object types 
+        /// (Int32, Double, Boolean ...), String objects, and byte arrays.
+        /// </summary>
+        /// <param name="value">
+        /// A <see cref="System.Object"/>
+        /// the object in the .NET programming language to be written; it must not be null
+        /// </param>
+        /// <exception cref="Apache.NMS.MessageFormatException">
+        /// Thrown when the Message has an invalid format.
+        /// </exception> 
+        /// <exception cref="Apache.NMS.MessageNotWriteableException">
+        /// Thrown when the Message is in read-only mode.
+        /// </exception>   
+        /// <exception cref="Apache.NMS.NMSException">
+        /// Thrown when there is an unhandled exception thrown from the provider.
+        /// </exception>  
+        void WriteObject( System.Object value );
+        
+        /// <summary>
+        /// Puts the message body in read-only mode and repositions the stream of bytes to the beginning.
+        /// </summary>
+        /// <exception cref="Apache.NMS.MessageFormatException">
+        /// Thrown when the Message has an invalid format.
+        /// </exception> 
+        /// <exception cref="Apache.NMS.NMSException">
+        /// Thrown when there is an unhandled exception thrown from the provider.
+        /// </exception>  
+        void Reset();
+        
 	}
 }
 

Modified: activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/IMessage.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/IMessage.cs?rev=821052&r1=821051&r2=821052&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/IMessage.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/IMessage.cs Fri Oct  2 15:19:22 2009
@@ -28,6 +28,22 @@
 		/// message has been processed correctly.
 		/// </summary>
 		void Acknowledge();
+        
+        /// <summary>
+        /// Clears out the message body. Clearing a message's body does not clear its header 
+        /// values or property entries.
+        /// 
+        /// If this message body was read-only, calling this method leaves the message body in 
+        /// the same state as an empty body in a newly created message.
+        /// </summary>
+        void ClearBody();
+        
+        /// <summary>
+        /// Clears a message's properties.
+        /// 
+        /// The message's header fields and body are not cleared.
+        /// </summary>
+        void ClearProperties();
 		
 		/// <summary>
 		/// Provides access to the message properties (headers).

Modified: activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/BytesMessageTest.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/BytesMessageTest.cs?rev=821052&r1=821051&r2=821052&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/BytesMessageTest.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/BytesMessageTest.cs Fri Oct  2 15:19:22 2009
@@ -49,12 +49,82 @@
 
 						IMessage message = consumer.Receive(receiveTimeout);
 						AssertBytesMessageEqual(request, message);
+                        AssertMessageIsReadOnly(message);
 						Assert.AreEqual(deliveryMode, message.NMSDeliveryMode, "NMSDeliveryMode does not match");
+
 					}
 				}
 			}
 		}
 
+        [RowTest]
+        [Row(MsgDeliveryMode.Persistent)]
+        [Row(MsgDeliveryMode.NonPersistent)]
+        public void SendReceiveBytesMessageContentTest(MsgDeliveryMode deliveryMode)
+        {
+            using(IConnection connection = CreateConnection(TEST_CLIENT_ID))
+            {
+                connection.Start();
+                using(ISession session = connection.CreateSession(AcknowledgementMode.AutoAcknowledge))
+                {
+                    IDestination destination = SessionUtil.GetDestination(session, DESTINATION_NAME);
+                    using(IMessageConsumer consumer = session.CreateConsumer(destination))
+                    using(IMessageProducer producer = session.CreateProducer(destination))
+                    {
+                        producer.DeliveryMode = deliveryMode;
+                        producer.RequestTimeout = receiveTimeout;
+                        IBytesMessage request = session.CreateBytesMessage();
+                        
+                        request.WriteBoolean(true);
+                        request.WriteByte((byte) 1);
+                        request.WriteBytes(new byte[1]);
+                        request.WriteBytes(new byte[3], 0, 2);
+                        request.WriteChar('a');
+                        request.WriteDouble(1.5);
+                        request.WriteSingle((float) 1.5);
+                        request.WriteInt32(1);
+                        request.WriteInt64(1);
+                        request.WriteObject("stringobj");
+                        request.WriteInt16((short) 1);
+                        request.WriteString("utfstring");
+                        
+                        producer.Send(request);
+
+                        IMessage message = consumer.Receive(receiveTimeout);
+                        AssertBytesMessageEqual(request, message);
+                        AssertMessageIsReadOnly(message);
+                        Assert.AreEqual(deliveryMode, message.NMSDeliveryMode, "NMSDeliveryMode does not match");
+
+                    }
+                }
+            }
+        }
+        
+        protected void AssertMessageIsReadOnly(IMessage message)
+        {
+            IBytesMessage theMessage = message as IBytesMessage;
+            Assert.IsNotNull(theMessage);
+            try
+            {
+                theMessage.WriteBoolean(true);
+                theMessage.WriteByte((byte) 1);
+                theMessage.WriteBytes(new byte[1]);
+                theMessage.WriteBytes(new byte[3], 0, 2);
+                theMessage.WriteChar('a');
+                theMessage.WriteDouble(1.5);
+                theMessage.WriteSingle((float) 1.5);
+                theMessage.WriteInt32(1);
+                theMessage.WriteInt64(1);
+                theMessage.WriteObject("stringobj");
+                theMessage.WriteInt16((short) 1);
+                theMessage.WriteString("utfstring");
+                Assert.Fail("Message should not have been Writable");
+            }
+            catch(MessageNotWriteableException)
+            {
+            }
+        }
+        
 		/// <summary>
 		/// Assert that two messages are IBytesMessages and their contents are equal.
 		/// </summary>