public Object valueOf(Serializer serializer, SerializedData serialized, Dictionary<string, object> context)
        {
            int oid = serialized.consumeSize();
            serialized.skipOver(1);     // "{"
            string name = (string)serializer.valueOf(serialized, context);
            serialized.skipOver(1);     // "}";

            return Proxy.NewProxyInstance(oid, name, (XPProtocol)context["handler"]);
        }
 public string representationOf(Serializer serializer, Object value, Dictionary<string, object> context)
 {
     throw new NotImplementedException();
 }
示例#3
0
        /// <summary>
        /// Initialize client/server communication
        /// </summary>
        /// <param name="proxy">The Uri object specifying the remote endpoint</param>
        public void initialize(Uri proxy)
        {
            this.sock = new TcpClient();

            try
            {
                this.sock.Connect(proxy.Host, proxy.Port);
                this.sock.NoDelay = true;
            }
            catch (SocketException e)
            {
                throw new RemoteException("Failed connecting to " + proxy, e);
            }

            // Set up serializer
            this.serializer = new Serializer();
            this.serializer.mappings['I'] = new RemoteInterfaceMapping();
            this.serializerContext["handler"] = this;

            // Start up socket communication
            this.writer = new BinaryWriter(this.sock.GetStream());
            this.reader = new BinaryReader(this.sock.GetStream());
            this.SendPacket(REMOTE_MSG_INIT, "\x01"); // FIXME: Doesn't support user/password yet
        }