private static void TestDeserializeDeviedCore( int id, object returnValue, bool isVoid, RpcException error )
		{
			if ( isVoid )
			{
				Assert.IsNull( returnValue, "Return value should not be specified in void." );
			}

			if ( error != null )
			{
				Assert.IsNull( returnValue, "Return value shoud not be specified in error." );
				Assert.IsFalse( isVoid, "isVoid should be false in error test." );
			}
			// TODO: Mock filters
			var objectTracingFilter = new DeserializedResponseTracingFilterProvider();
			var binaryTracingFilter = new DeserializingResponseTracingFilterProvider();
			var target =
				SerializerFactory.CreateResponseMessageSerializerWithTracer(
					null,
					null,
					binaryTracingFilter,
					objectTracingFilter
				);
			try
			{
				var expected =
					new MessagePackObject(
						new MessagePackObject[]
					{
						new MessagePackObject( ( int )MessageType.Response ),
						new MessagePackObject( ( uint )id ),
						error == null ? MessagePackObject.Nil : error.RpcError.Identifier,
						returnValue == null 
							? ( error == null ? MessagePackObject.Nil : error.GetExceptionMessage( false ) )
							: MessagePackObject.FromObject( returnValue )						
					}
					);
				var stream = new MemoryStream();
				Packer.Create( stream ).Pack( expected );
				var serialized = stream.ToArray();
				var packets = Segmentate( serialized, 10 ).ToArray();
				int indexOfPackets = 0;
				using ( var underlying = ChunkBuffer.CreateDefault() )
				{
					underlying.Feed( new ArraySegment<byte>( packets[ 0 ] ) );
					using ( var buffer =
						new RpcInputBuffer<object, object>(
							underlying,
							( _0, _1, _2 ) => ChunkBuffer.CreateDefault(),
							( item, _0, _1 ) =>
							{
								indexOfPackets++;
								if ( indexOfPackets >= packets.Length )
								{
									return default( BufferFeeding );
									//Assert.Fail( "Over requesting." );
								}

								item.Reset();
								item.Feed( new ArraySegment<byte>( packets[ indexOfPackets ] ) );
								return new BufferFeeding( packets[ indexOfPackets ].Length );
							},
							null
						) )
					{
						ResponseMessage actual;
						var result = target.Deserialize( buffer, out actual );
						Assert.IsTrue( result.IsSuccess, result.ToString() );
						Assert.AreEqual( id, actual.MessageId );
						if ( isVoid || returnValue == null )
						{
							Assert.IsTrue( actual.ReturnValue.IsNil );
						}
						else
						{
							Assert.AreEqual( returnValue.ToString(), actual.ReturnValue.AsString() );
						}

						if ( error == null )
						{
							Assert.IsNull( actual.Error );
						}
						else
						{
							Assert.AreEqual( expected.AsList()[ 2 ].AsString(), actual.Error.RpcError.Identifier );
							Assert.AreEqual( expected.AsList()[ 3 ].AsDictionary()[ MessagePackConvert.EncodeString( "ErrorCode" ) ].AsInt32(), actual.Error.RpcError.ErrorCode );
							Assert.AreEqual( expected.AsList()[ 3 ].AsDictionary()[ MessagePackConvert.EncodeString( "Message" ) ].AsString(), actual.Error.Message );
							if ( expected.AsList()[ 3 ].AsDictionary().ContainsKey( MessagePackConvert.EncodeString( "DebugInformation" ) ) )
							{
								Assert.AreEqual( expected.AsList()[ 3 ].AsDictionary()[ MessagePackConvert.EncodeString( "DebugInformation" ) ].AsString(), actual.Error.DebugInformation );
							}
							else
							{
								Assert.IsNull( actual.Error.DebugInformation );
							}
						}
					}
				}
			}
			finally
			{
				Console.WriteLine( "BINARY TRACE:{0}", binaryTracingFilter.GetTrace() );
				Console.WriteLine( "OBJECT TRACE:{0}", objectTracingFilter.GetTrace() );
			}
		}