Package org.apache.qpid.framing

Examples of org.apache.qpid.framing.ProtocolInitiation$Decoder


    }

    @Override
    public void init()
    {
        _ioSender.send(new ProtocolInitiation(_connection.getProtocolVersion()).toNioByteBuffer());
        _ioSender.flush();
    }
View Full Code Here


                    else if (message instanceof ProtocolInitiation)
                    {
                        // We get here if the server sends a response to our initial protocol header
                        // suggesting an alternate ProtocolVersion; the server will then close the
                        // connection.
                        ProtocolInitiation protocolInit = (ProtocolInitiation) message;
                        _suggestedProtocolVersion = protocolInit.checkVersion();
                        _logger.info("Broker suggested using protocol version:" + _suggestedProtocolVersion);

                        // get round a bug in old versions of qpid whereby the connection is not closed
                        _stateManager.changeState(AMQState.CONNECTION_CLOSED);
                    }
View Full Code Here

    public void init()
    {
        // start the process of setting up the connection. This is the first place that
        // data is written to the server.
        _protocolHandler.writeFrame(new ProtocolInitiation(_connection.getProtocolVersion()));
    }
View Full Code Here

                    else if (message instanceof ProtocolInitiation)
                    {
                        // We get here if the server sends a response to our initial protocol header
                        // suggesting an alternate ProtocolVersion; the server will then close the
                        // connection.
                        ProtocolInitiation protocolInit = (ProtocolInitiation) message;
                        _suggestedProtocolVersion = protocolInit.checkVersion();
                        _logger.info("Broker suggested using protocol version:" + _suggestedProtocolVersion);

                        // get round a bug in old versions of qpid whereby the connection is not closed
                        _stateManager.changeState(AMQState.CONNECTION_CLOSED);
                    }
View Full Code Here

                    else if (message instanceof ProtocolInitiation)
                    {
                        // We get here if the server sends a response to our initial protocol header
                        // suggesting an alternate ProtocolVersion; the server will then close the
                        // connection.
                        ProtocolInitiation protocolInit = (ProtocolInitiation) message;
                        _suggestedProtocolVersion = protocolInit.checkVersion();
                        _logger.info("Broker suggested using protocol version:" + _suggestedProtocolVersion);

                        // get round a bug in old versions of qpid whereby the connection is not closed
                        _stateManager.changeState(AMQState.CONNECTION_CLOSED);
                    }
View Full Code Here

        // data is written to the server.
        /* Find last protocol version in protocol version list. Make sure last protocol version
        listed in the build file (build-module.xml) is the latest version which will be used
        here. */
        int i = pv.length - 1;
        _minaProtocolSession.write(new ProtocolInitiation(pv[i][PROTOCOL_MAJOR], pv[i][PROTOCOL_MINOR]));
    }
View Full Code Here

            throws Exception
    {
        _lastReceived = message;
        if (message instanceof ProtocolInitiation)
        {
            ProtocolInitiation pi = (ProtocolInitiation) message;
            // this ensures the codec never checks for a PI message again
            ((AMQDecoder)_codecFactory.getDecoder()).setExpectProtocolInitiation(false);
            try {
                pi.checkVersion(this); // Fails if not correct
                // This sets the protocol version (and hence framing classes) for this session.
                _major = pi.protocolMajor;
                _minor = pi.protocolMinor;
                String mechanisms = ApplicationRegistry.getInstance().getAuthenticationManager().getMechanisms();
                String locales = "en_US";
                AMQFrame response = ConnectionStartBody.createAMQFrame((short)0, pi.protocolMajor, pi.protocolMinor, null,
                                                                       mechanisms.getBytes(), locales.getBytes());
                _minaProtocolSession.write(response);
            } catch (AMQException e) {
                _logger.error("Received incorrect protocol initiation", e);
                /* Find last protocol version in protocol version list. Make sure last protocol version
                listed in the build file (build-module.xml) is the latest version which will be used
                here. */
                int i = pv.length - 1;
                _minaProtocolSession.write(new ProtocolInitiation(pv[i][PROTOCOL_MAJOR], pv[i][PROTOCOL_MINOR]));
                // TODO: Close connection (but how to wait until message is sent?)
            }
        }
        else
        {
View Full Code Here

           
            /* Find last protocol version in protocol version list. Make sure last protocol version
            listed in the build file (build-module.xml) is the latest version which will be used
            here. */
            int i = pv.length - 1;
            session.write(new ProtocolInitiation(pv[i][PROTOCOL_MAJOR], pv[i][PROTOCOL_MINOR]));
        }
View Full Code Here

        }
        catch (AMQException e)
        {
            _logger.info("Received unsupported protocol initiation for protocol version: " + getProtocolVersion());

            _networkDriver.send(new ProtocolInitiation(ProtocolVersion.getLatestSupportedVersion()).toNioByteBuffer());
        }
    }
View Full Code Here

    public void exception(Throwable throwable)
    {
        if (throwable instanceof AMQProtocolHeaderException)
        {
            writeFrame(new ProtocolInitiation(ProtocolVersion.getLatestSupportedVersion()));
            _networkDriver.close();

            _logger.error("Error in protocol initiation " + this + ":" + getRemoteAddress() + " :" + throwable.getMessage(), throwable);
        }
        else if (throwable instanceof IOException)
View Full Code Here

TOP

Related Classes of org.apache.qpid.framing.ProtocolInitiation$Decoder

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.