public void TestPickleUnpickleUri() { PyroURI uri = new PyroURI("PYRO:test@localhost:9999"); PyroSerializer ser = new PickleSerializer(); var pickledUri = ser.serializeData(uri); PyroURI uri2 = (PyroURI)ser.deserializeData(pickledUri); Assert.Equal(uri, uri2); uri = new PyroURI(); pickledUri = ser.serializeData(uri); uri2 = (PyroURI)ser.deserializeData(pickledUri); Assert.Equal(uri, uri2); }
public void testPickleUnpickleURI() { PyroURI uri = new PyroURI("PYRO:test@localhost:9999"); PyroSerializer ser = new PickleSerializer(); byte[] pickled_uri = ser.serializeData(uri); PyroURI uri2 = (PyroURI)ser.deserializeData(pickled_uri); Assert.AreEqual(uri, uri2); uri = new PyroURI(); pickled_uri = ser.serializeData(uri); uri2 = (PyroURI)ser.deserializeData(pickled_uri); Assert.AreEqual(uri, uri2); }
public void PyroClassesPickle() { var pickler = new PickleSerializer(); var uri = new PyroURI("PYRO:something@localhost:4444"); byte[] s = pickler.serializeData(uri); object x = pickler.deserializeData(s); Assert.Equal(uri, x); var proxy = new PyroProxy(uri) { correlation_id = Guid.NewGuid(), pyroHandshake = "apples", pyroHmacKey = Encoding.UTF8.GetBytes("secret"), pyroAttrs = new HashSet <string> { "attr1", "attr2" } }; s = pickler.serializeData(proxy); x = pickler.deserializeData(s); PyroProxy proxy2 = (PyroProxy)x; Assert.Equal(uri.host, proxy2.hostname); Assert.Equal(uri.objectid, proxy2.objectid); Assert.Equal(uri.port, proxy2.port); Assert.Null(proxy2.correlation_id); // "correlation_id is not serialized on the proxy object" Assert.Equal(proxy.pyroHandshake, proxy2.pyroHandshake); Assert.Equal(proxy.pyroHmacKey, proxy2.pyroHmacKey); Assert.Equal(2, proxy2.pyroAttrs.Count); Assert.Equal(proxy.pyroAttrs, proxy2.pyroAttrs); PyroException ex = new PyroException("error"); s = pickler.serializeData(ex); x = pickler.deserializeData(s); PyroException ex2 = (PyroException)x; Assert.Equal("[Pyro4.errors.PyroError] error", ex2.Message); Assert.Null(ex._pyroTraceback); }
public void testPickleUnpickleProxy() { PyroProxy proxy = new PyroProxy("hostname", 9999, "objectid"); PyroSerializer ser = new PickleSerializer(); byte[] pickled_proxy = ser.serializeData(proxy); PyroProxy result = (PyroProxy)ser.deserializeData(pickled_proxy); Assert.AreEqual(proxy.hostname, result.hostname); Assert.AreEqual(proxy.objectid, result.objectid); Assert.AreEqual(proxy.port, result.port); }
public void TestPickleUnpickleProxy() { PyroProxy proxy = new PyroProxy("hostname", 9999, "objectid") { pyroHmacKey = Encoding.UTF8.GetBytes("secret"), pyroHandshake = "apples" }; PyroSerializer ser = new PickleSerializer(); var pickledProxy = ser.serializeData(proxy); PyroProxy result = (PyroProxy)ser.deserializeData(pickledProxy); Assert.Equal(proxy.hostname, result.hostname); Assert.Equal(proxy.objectid, result.objectid); Assert.Equal(proxy.port, result.port); Assert.Equal(Encoding.UTF8.GetBytes("secret"), result.pyroHmacKey); Assert.Equal("apples", result.pyroHandshake); }