Package org.apache.qpid.transport

Examples of org.apache.qpid.transport.Binary


    }

    public String readStr8()
    {
        short size = readUint8();
        Binary bin = get(size);
        String str = str8cache.get(bin);

        if (str == null)
        {
            str = decode(bin.array(), bin.offset(), bin.size(), "UTF-8");
            if(bin.hasExcessCapacity())
            {
                str8cache.put(bin.copy(), str);
            }
            else
            {
                str8cache.put(bin, str);
            }
View Full Code Here


    protected Binary get(int size)
    {
        if (in.hasArray())
        {
            byte[] bytes = in.array();
            Binary bin = new Binary(bytes, in.arrayOffset() + in.position(), size);
            in.position(in.position() + size);
            return bin;
        }
        else
        {
View Full Code Here

    public void testCompareTo() throws Exception
    {
        ServerConnection connection = new ServerConnection(1);
        connection.setVirtualHost(_virtualHost);
        ServerSession session1 = new ServerSession(connection, new ServerSessionDelegate(),
                new Binary(getName().getBytes()), 0);

        // create a session with the same name but on a different connection
        ServerConnection connection2 = new ServerConnection(2);
        connection2.setVirtualHost(_virtualHost);
        ServerSession session2 = new ServerSession(connection2, new ServerSessionDelegate(),
                new Binary(getName().getBytes()), 0);

        assertFalse("Unexpected compare result", session1.compareTo(session2) == 0);
        assertEquals("Unexpected compare result", 0, session1.compareTo(session1));
    }
View Full Code Here

    protected Binary get(int size)
    {
        if (in.hasArray())
        {
            byte[] bytes = in.array();
            Binary bin = new Binary(bytes, in.arrayOffset() + in.position(), size);
            in.position(in.position() + size);
            return bin;
        }
        else
        {
View Full Code Here

        //create a 0-10 subscription
        ServerConnection conn = new ServerConnection(1);
        ProtocolEngine_0_10 engine = new ProtocolEngine_0_10(conn, new TestNetworkConnection());
        conn.setVirtualHost(_session.getVirtualHost());
        ServerSessionDelegate sesDel = new ServerSessionDelegate();
        Binary name = new Binary(new byte[]{new Byte("1")});
        ServerSession session = new ServerSession(conn, sesDel, name, 0);

        Subscription sub_0_10 = SubscriptionFactoryImpl.INSTANCE.createSubscription(session, "1", MessageAcceptMode.EXPLICIT,
                MessageAcquireMode.PRE_ACQUIRED, MessageFlowMode.WINDOW, new WindowCreditManager(), null, null);
        assertEquals("Unexpected Subscription ID allocated", previousId + 1, sub_0_10.getSubscriptionID());
View Full Code Here

    {
        final Broker broker = mock(Broker.class);
        ServerConnection connection = new ServerConnection(1, broker);
        connection.setVirtualHost(_virtualHost);
        ServerSession session1 = new ServerSession(connection, new ServerSessionDelegate(),
                new Binary(getName().getBytes()), 0);

        // create a session with the same name but on a different connection
        ServerConnection connection2 = new ServerConnection(2, broker);
        connection2.setVirtualHost(_virtualHost);
        ServerSession session2 = new ServerSession(connection2, new ServerSessionDelegate(),
                new Binary(getName().getBytes()), 0);

        assertFalse("Unexpected compare result", session1.compareTo(session2) == 0);
        assertEquals("Unexpected compare result", 0, session1.compareTo(session1));
    }
View Full Code Here

    protected Binary get(int size)
    {
        byte[] bytes = new byte[size];
        get(bytes);
        return new Binary(bytes);
    }
View Full Code Here

    }

    public String readStr8()
    {
        short size = readUint8();
        Binary bin = get(size);
        String str = str8cache.get(bin);
        if (str == null)
        {
            str = decode(bin.array(), bin.offset(), bin.size(), "UTF-8");
            str8cache.put(bin, str);
        }
        return str;
    }
View Full Code Here

        //create a 0-10 subscription
        ServerConnection conn = new ServerConnection(1);
        ProtocolEngine_0_10 engine = new ProtocolEngine_0_10(conn, new TestNetworkConnection(), getRegistry());
        conn.setVirtualHost(getVirtualHost());
        ServerSessionDelegate sesDel = new ServerSessionDelegate();
        Binary name = new Binary(new byte[]{new Byte("1")});
        ServerSession session = new ServerSession(conn, sesDel, name, 0);

        Subscription sub_0_10 = SubscriptionFactoryImpl.INSTANCE.createSubscription(session, "1", MessageAcceptMode.EXPLICIT,
                MessageAcquireMode.PRE_ACQUIRED, MessageFlowMode.WINDOW, new WindowCreditManager(), null, null);
        assertEquals("Unexpected Subscription ID allocated", previousId + 1, sub_0_10.getSubscriptionID());
View Full Code Here

        TabularData tabularData = _mbean.channels();

        int channelCount = tabularData.size();
        assertEquals("Unexpected number of channels",1,channelCount);
        _sessions.add(new ServerSession(_serverConnection, new ServerSessionDelegate(),
                        new Binary(getName().getBytes()), 2 , _serverConnection.getConfig()));

        channelCount = _mbean.channels().size();
        assertEquals("Unexpected number of channels",2,channelCount);

        final CompositeData chanresult = tabularData.get(new Integer[]{1});
View Full Code Here

TOP

Related Classes of org.apache.qpid.transport.Binary

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.