Package org.apache.qpid.transport

Examples of org.apache.qpid.transport.Binary


        final Broker broker = mock(Broker.class);
        when(broker.getRootMessageLogger()).thenReturn(mock(RootMessageLogger.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


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

        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

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

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

        assertFalse("Unexpected compare result", session1.compareTo(session2) == 0);
        assertEquals("Unexpected compare result", 0, session1.compareTo(session1));
    }
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)
    {
        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 ServerSession getSession(Connection conn, SessionAttach atc)
    {
        SessionDelegate serverSessionDelegate = new ServerSessionDelegate();

        ServerSession ssn = new ServerSession(conn, serverSessionDelegate,  new Binary(atc.getName()), 0);

        return ssn;
    }
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

    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");
            if(bin.hasExcessCapacity())
            {
                str8cache.put(bin.copy(), str);
            }
            else
            {
                str8cache.put(bin, str);
            }
View Full Code Here

    protected Binary get(int size)
    {
        byte[] bytes = new byte[size];
        get(bytes);
        return new Binary(bytes);
    }
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.