예제 #1
0
        public static BTransport createTransport()
        {

            BRegistry registryBin = new BRegistry_Testser();

            BWire wire = new MyWire();

            BApiDescriptor apiDesc = new BApiDescriptor("TestSerialize",
                    "com.wilutions.byps.test.api",
                    0,
                    false);


            BProtocol proto = new BProtocolS(apiDesc, 1, 0, ByteOrder.LITTLE_ENDIAN);

            BTransport transport = new BTransport(apiDesc, wire, null);
            transport.setProtocol(proto);

            return transport;
        }
예제 #2
0
        private BProtocol detectProtocolFromInputBuffer(ByteBuffer buf)
        {
            BProtocol ret = null;

            // Read the first 4 bytes to detect the protocol.
            int magic = BMessageHeader.detectProtocol(buf);

            if (magic == BMessageHeader.MAGIC_BINARY_STREAM)
            {
                // Version, ByteOrder wird in BInput gelesen
                ret = new BProtocolS(apiDesc);
            }

            if (ret == null)
            {
                throw new BException(BExceptionC.CORRUPT, "Invalid protocol.");
            }

            return(ret);
        }