Package org.apache.qpid.transport

Examples of org.apache.qpid.transport.TestNetworkConnection


        assertEquals("Unexpected Subscription ID allocated", previousId + 1, getNoAckSub.getSubscriptionID());
        previousId = getNoAckSub.getSubscriptionID();

        //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());
        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);
View Full Code Here


    private AtomicInteger _deliveryCount = new AtomicInteger(0);
    private static final AtomicLong ID_GENERATOR = new AtomicLong(0);

    public InternalTestProtocolSession(VirtualHost virtualHost) throws AMQException
    {
        super(ApplicationRegistry.getInstance().getVirtualHostRegistry(), new TestNetworkConnection(), ID_GENERATOR.getAndIncrement());

        _channelDelivers = new HashMap<Integer, Map<AMQShortString, LinkedList<DeliveryPair>>>();

        // Need to authenticate session for it to be representative testing.
        setAuthorizedSubject(new Subject(true, Collections.singleton(new UsernamePrincipal("InternalTestProtocolSession")),
View Full Code Here

            long expectedID = previousId + 1;
            byte[] header = getAmqpHeader(version);
            assertNotNull("protocol header should not be null", header);

            ServerProtocolEngine engine = factory.newProtocolEngine();
            TestNetworkConnection conn = new TestNetworkConnection();
            engine.setNetworkConnection(conn, conn.getSender());
            assertEquals("ID did not increment as expected", expectedID, engine.getConnectionId());

            //actually feed in the AMQP header for this protocol version, and ensure the ID remains consistent
            engine.received(ByteBuffer.wrap(header));
            assertEquals("ID was not as expected following receipt of the AMQP version header", expectedID, engine.getConnectionId());
View Full Code Here

            long expectedID = previousId + 1;
            byte[] header = getAmqpHeader(version);
            assertNotNull("protocol header should not be null", header);

            ServerProtocolEngine engine = factory.newProtocolEngine();
            TestNetworkConnection conn = new TestNetworkConnection();
            engine.setNetworkConnection(conn, conn.getSender());
            assertEquals("ID did not increment as expected", expectedID, engine.getConnectionId());

            //actually feed in the AMQP header for this protocol version, and ensure the ID remains consistent
            engine.received(ByteBuffer.wrap(header));
            assertEquals("ID was not as expected following receipt of the AMQP version header", expectedID, engine.getConnectionId());
View Full Code Here

        MultiVersionProtocolEngineFactory factory =
            new MultiVersionProtocolEngineFactory("localhost", versions);

        //create a dummy to retrieve the 'current' ID number
        long previousId = factory.newProtocolEngine(new TestNetworkConnection()).getConnectionId();

        //create a protocol engine and send the AMQP header for all supported AMQP verisons,
        //ensuring the ID assigned increases as expected
        for(AmqpProtocolVersion version : versions)
        {
            long expectedID = previousId + 1;
            byte[] header = getAmqpHeader(version);
            assertNotNull("protocol header should not be null", header);

            ServerProtocolEngine engine = factory.newProtocolEngine(new TestNetworkConnection());
            assertEquals("ID did not increment as expected", expectedID, engine.getConnectionId());

            //actually feed in the AMQP header for this protocol version, and ensure the ID remains consistent
            engine.received(ByteBuffer.wrap(header));
            assertEquals("ID was not as expected following receipt of the AMQP version header", expectedID, engine.getConnectionId());
View Full Code Here

    @Override
    public void setUp() throws Exception
    {
        //Create a new ProtocolHandler with a fake connection.
        _handler = new AMQProtocolHandler(new MockAMQConnection("amqp://guest:guest@client/test?brokerlist='tcp://localhost:1'"));
        _handler.setNetworkConnection(new TestNetworkConnection());
         AMQBody body = BasicRecoverOkBodyImpl.getFactory().newInstance(null, 1);
        _blockFrame = new AMQFrame(0, body);

        _handleCountDown = new CountDownLatch(1);
View Full Code Here

    private AtomicInteger _deliveryCount = new AtomicInteger(0);
    private static final AtomicLong ID_GENERATOR = new AtomicLong(0);

    public InternalTestProtocolSession(VirtualHost virtualHost) throws AMQException
    {
        super(ApplicationRegistry.getInstance().getVirtualHostRegistry(), new TestNetworkConnection(), ID_GENERATOR.getAndIncrement());

        _channelDelivers = new HashMap<Integer, Map<AMQShortString, LinkedList<DeliveryPair>>>();

        // Need to authenticate session for it to be representative testing.
        setAuthorizedSubject(new Subject(true, Collections.singleton(new UsernamePrincipal("InternalTestProtocolSession")),
View Full Code Here

    {
        super.setUp();

        AMQConnection con = (AMQConnection) getConnection("guest", "guest");
        AMQProtocolHandler protocolHandler = new AMQProtocolHandler(con);
        protocolHandler.setNetworkConnection(new TestNetworkConnection());

        //don't care about the values set here apart from the dummy IoSession
        _testSession = new TestProtocolSession(protocolHandler , con);
    }
View Full Code Here

    @Override
    public void setUp() throws Exception
    {
        //Create a new ProtocolHandler with a fake connection.
        _handler = new AMQProtocolHandler(new MockAMQConnection("amqp://guest:guest@client/test?brokerlist='tcp://localhost:1'"));
        _handler.setNetworkConnection(new TestNetworkConnection());
         AMQBody body = BasicRecoverOkBodyImpl.getFactory().newInstance(null, 1);
        _blockFrame = new AMQFrame(0, body);

        _handleCountDown = new CountDownLatch(1);
View Full Code Here

        assertEquals("Unexpected Subscription ID allocated", previousId + 1, getNoAckSub.getSubscriptionID());
        previousId = getNoAckSub.getSubscriptionID();

        //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);
View Full Code Here

TOP

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

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.