public void Invoke_sends_request_and_restore_result()
		{
			StubSocket socket = null;

			_context = new StubContext(type =>
			{
				socket = new StubSocket(type);
				socket.ToRecv.Add(Builder.SerializeResponse( Builder.BuildResponse(new Tuple<object, Type>("hello", typeof(string))) ));
				return socket;
			});


			var req = new RemoteRequestService(_context, _registry, _serialization, new RequestPoll(_context));

			var result = req.Invoke(TestHostName, TestService, "method",
									new object[0], Type.EmptyTypes, typeof(string));

			result.Should().Be("hello");
		}
		public void Invoke_sends_request_and_restore_exception()
		{
			StubSocket socket = null;

			_context = new StubContext(type =>
			{
				socket = new StubSocket(type);
				socket.ToRecv.Add(Builder.SerializeResponse(Builder.BuildResponse(new Exception("for testing"))));
				return socket;
			});

			var req = new RemoteRequestService(_context, _registry, _serialization, new RequestPoll(_context));

			Assert.Throws<Exception>(() =>
			{
				var result = req.Invoke(TestHostName, TestService, "method",
					new object[0], Type.EmptyTypes, typeof (string));

			}).Message.Should().Be("Remote server or invoker threw Exception with message for testing");
		}
		public void Invoke_sends_request_to_right_endpoint()
		{
			StubSocket socket = null;

			_context = new StubContext(type =>
			{
				socket = new StubSocket(type);
				socket.ToRecv.Add( Builder.SerializeResponse(new ResponseMessage()) );
				return socket;
			});


			var req = new RemoteRequestService(_context, _registry, _serialization, new RequestPoll(_context));

			var result = req.Invoke(TestHostName, TestService, "method", 
									new object[0], Type.EmptyTypes, typeof (void));

			socket.ConnectedToEndpoint.Should().Be("endpoint1"); 
			result.Should().BeNull();
		}