- MarshalObject objMarshal = NewMarshalObject();\r
- \r
- IDictionary props = new Hashtable();\r
- props["name"] = objMarshal.Uri;\r
- props["port"] = 1237;\r
- TcpChannel chn = new TcpChannel(props, null, null);\r
- ChannelServices.RegisterChannel(chn);\r
- \r
- RemotingServices.Marshal(objMarshal,objMarshal.Uri);\r
- \r
- MarshalObject objRem = (MarshalObject) RemotingServices.Connect(typeof(MarshalObject), "tcp://localhost:1237/" + objMarshal.Uri);\r
- // This line sould throw a RemotingException\r
- // It is forbidden to export an object which is not\r
- // a real object\r
- try\r
- {\r
- RemotingServices.Marshal(objRem, objMarshal.Uri);\r
+ MarshalObject objMarshal = NewMarshalObject ();\r
+\r
+ IDictionary props = new Hashtable ();\r
+ props ["name"] = objMarshal.Uri;\r
+ props ["port"] = 1237;\r
+ TcpChannel chn = new TcpChannel (props, null, null);\r
+ ChannelServices.RegisterChannel (chn);\r
+\r
+ try {\r
+ RemotingServices.Marshal (objMarshal, objMarshal.Uri);\r
+ MarshalObject objRem = (MarshalObject) RemotingServices.Connect (typeof (MarshalObject), "tcp://localhost:1237/" + objMarshal.Uri);\r
+ // This line should throw a RemotingException\r
+ // It is forbidden to export an object which is not\r
+ // a real object\r
+ try {\r
+ RemotingServices.Marshal (objRem, objMarshal.Uri);\r
+ Fail ("#1");\r
+ } catch (RemotingException e) {\r
+ }\r
+ } finally {\r
+ ChannelServices.UnregisterChannel (chn);\r
+\r
+ // TODO: uncomment when RemotingServices.Disconnect is implemented\r
+ //RemotingServices.Disconnect(objMarshal);\r