Package org.apache.qpid.proton.amqp.transport

Examples of org.apache.qpid.proton.amqp.transport.Open


        // containerId and extended header sized to give an open frame
        // exactly 512 bytes in length.
        String containerId = "12345678";
        int extendedHeaderSize = 122 * 4;

        Open open = new Open();
        open.setContainerId(containerId);
        byte[] openFrameBuffer = _framer.generateFrame(0, new byte[extendedHeaderSize], open);
        assertEquals("Test requires a frame of size MIN_MAX_FRAME_SIZE",
                Transport.MIN_MAX_FRAME_SIZE, openFrameBuffer.length);

        int serverConsumed = _serverTransport.input(openFrameBuffer, 0, openFrameBuffer.length);
View Full Code Here


        // 1 byte larger the than 512 bytes permitted before negotiation by the AMQP spec.

        String containerId = "123456789";
        int extendedHeaderSize = 122 * 4;

        Open bigOpen = new Open();
        bigOpen.setContainerId(containerId);
        byte[] openFrameBuffer = _framer.generateFrame(0, new byte[extendedHeaderSize], bigOpen);
        assertEquals("Test requires a frame of size MIN_MAX_FRAME_SIZE + 1",
                Transport.MIN_MAX_FRAME_SIZE + 1, openFrameBuffer.length);

        int serverConsumed = _serverTransport.input(openFrameBuffer, 0, openFrameBuffer.length);
View Full Code Here

    @Test
    public void testReceiptOfSecondOpen_causesTODO()
    {
        bindAndOpenConnections();

        Open secondOpen  = new Open(); // erroneous
        secondOpen.setContainerId("secondOpen");
        byte[] openFrameBuffer = _framer.generateFrame(0, secondOpen);

        int serverConsumed = _serverTransport.input(openFrameBuffer, 0, openFrameBuffer.length);
        assertEquals(openFrameBuffer.length, serverConsumed);
View Full Code Here

    @Ignore("Reinstate once it is agreed how error condition will be reported to user of API")
    public void testReceiptOfOpenOnNonZeroChannelNumber_causesTODO()
    {
        _pumper.pumpAll();

        Open open = new Open();
        open.setContainerId(SERVER_CONTAINER);

        int nonZeroChannelId = 1;
        byte[] buf = _framer.generateFrame(nonZeroChannelId, open);
        int rv = _serverTransport.input(buf, 0, buf.length);
        // TODO server should indicate error
View Full Code Here

    private int processOpen(WritableBuffer buffer)
    {
        if(_connectionEndpoint != null && _connectionEndpoint.getLocalState() != EndpointState.UNINITIALIZED && !_isOpenSent)
        {
            Open open = new Open();
            open.setContainerId(_connectionEndpoint.getLocalContainerId());
            open.setHostname(_connectionEndpoint.getHostname());
            open.setDesiredCapabilities(_connectionEndpoint.getDesiredCapabilities());
            open.setOfferedCapabilities(_connectionEndpoint.getOfferedCapabilities());
            open.setProperties(_connectionEndpoint.getProperties());
            // TODO - populate;

            _isOpenSent = true;

            return  writeFrame(buffer, 0, open, null, null);
View Full Code Here

    public Open newInstance(Object described)
    {
        List l = (List) described;

        Open o = new Open();

        if(l.isEmpty())
        {
            throw new DecodeException("The container-id field cannot be omitted");
        }

        switch(10 - l.size())
        {

            case 0:
                o.setProperties( (Map) l.get( 9 ) );
            case 1:
                Object val1 = l.get( 8 );
                if( val1 == null || val1.getClass().isArray() )
                {
                    o.setDesiredCapabilities( (Symbol[]) val1 );
                }
                else
                {
                    o.setDesiredCapabilities( (Symbol) val1 );
                }
            case 2:
                Object val2 = l.get( 7 );
                if( val2 == null || val2.getClass().isArray() )
                {
                    o.setOfferedCapabilities( (Symbol[]) val2 );
                }
                else
                {
                    o.setOfferedCapabilities( (Symbol) val2 );
                }
            case 3:
                Object val3 = l.get( 6 );
                if( val3 == null || val3.getClass().isArray() )
                {
                    o.setIncomingLocales( (Symbol[]) val3 );
                }
                else
                {
                    o.setIncomingLocales( (Symbol) val3 );
                }
            case 4:
                Object val4 = l.get( 5 );
                if( val4 == null || val4.getClass().isArray() )
                {
                    o.setOutgoingLocales( (Symbol[]) val4 );
                }
                else
                {
                    o.setOutgoingLocales( (Symbol) val4 );
                }
            case 5:
                o.setIdleTimeOut( (UnsignedInteger) l.get( 4 ) );
            case 6:
                UnsignedShort channelMax = (UnsignedShort) l.get(3);
                o.setChannelMax(channelMax == null ? UnsignedShort.MAX_VALUE : channelMax);
            case 7:
                UnsignedInteger maxFrameSize = (UnsignedInteger) l.get(2);
                o.setMaxFrameSize(maxFrameSize == null ? UnsignedInteger.MAX_VALUE : maxFrameSize);
            case 8:
                o.setHostname( (String) l.get( 1 ) );
            case 9:
                o.setContainerId( (String) l.get( 0 ) );
        }


        return o;
    }
View Full Code Here

    private void processOpen()
    {
        if(_connectionEndpoint != null && _connectionEndpoint.getLocalState() != EndpointState.UNINITIALIZED && !_isOpenSent)
        {
            Open open = new Open();
            String cid = _connectionEndpoint.getLocalContainerId();
            open.setContainerId(cid == null ? "" : cid);
            open.setHostname(_connectionEndpoint.getHostname());
            open.setDesiredCapabilities(_connectionEndpoint.getDesiredCapabilities());
            open.setOfferedCapabilities(_connectionEndpoint.getOfferedCapabilities());
            open.setProperties(_connectionEndpoint.getProperties());
            if (_maxFrameSize > 0) {
                open.setMaxFrameSize(UnsignedInteger.valueOf(_maxFrameSize));
            }
            if (_channelMax > 0) {
                open.setChannelMax(UnsignedShort.valueOf((short) _channelMax));
            }

            _isOpenSent = true;

            writeFrame(0, open, null, null);
View Full Code Here

    private int processOpen(WritableBuffer buffer)
    {
        if(_connectionEndpoint != null && _connectionEndpoint.getLocalState() != EndpointState.UNINITIALIZED && !_isOpenSent)
        {
            Open open = new Open();
            open.setContainerId(_connectionEndpoint.getLocalContainerId());
            open.setHostname(_connectionEndpoint.getHostname());
            // TODO - populate;

            _isOpenSent = true;

            return  writeFrame(buffer, 0, open, null, null);
View Full Code Here

TOP

Related Classes of org.apache.qpid.proton.amqp.transport.Open

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.