Package net.sf.cindy

Examples of net.sf.cindy.Packet


    public void sessionClosed(SessionFilterChain filterChain) throws Exception {
        try {
            if (engine != null) {
                engine.closeOutbound();
                if (!engine.isInboundDone()) {
                    Packet encodedPacket = encode(filterChain.getSession(),
                            new HandshakePacket());
                    if (encodedPacket != null)
                        encodedPacket.getContent().release();
                }
                engine.closeInbound();
            }
        } catch (SSLException ssle) {
            throw new SessionException(ssle);
View Full Code Here


        return null;
    }

    public void packetReceived(SessionFilterChain filterChain, Packet packet)
            throws Exception {
        Packet decodedPacket = decode(filterChain.getSession(), packet);
        if (decodedPacket != null)
            super.packetReceived(filterChain, decodedPacket);
    }
View Full Code Here

        if (queued) {
            tempQueue.offer(new QueuedPacket(filterChain, packet));
            return;
        }

        Packet encodedPacket = encode(filterChain.getSession(), packet);
        if (encodedPacket != null)
            super.packetSend(filterChain, encodedPacket);
    }
View Full Code Here

    }

    public Packet encode(Session session, Object obj) throws Exception {
        for (Iterator iter = chain.iterator(); iter.hasNext();) {
            PacketEncoder encoder = (PacketEncoder) iter.next();
            Packet packet = encoder.encode(session, obj);
            if (packet != null)
                return packet;
        }
        return null;
    }
View Full Code Here

    public Future send(Object obj) {
        return send(obj, 0);
    }

    public Future send(Object obj, int priority) {
        Packet packet = null;
        try {
            packet = encoder.encode(this, obj);
        } catch (Exception e) {
            dispatchException(e);
            return new DefaultFuture(this, false);
View Full Code Here

            for (int i = 0; i < 10; i++) {
                int value = random.nextInt();

                Object obj1 = new Integer(value);

                Packet packet = new SerialEncoder().encode(null, obj1);
                assertNotNull(packet);

                Object obj2 = new SerialDecoder().decode(null, packet);
                assertEquals(obj1, obj2);
            }
View Full Code Here

                    throws Exception {
                if (packet == null || packet.getContent() == null) {
                    future.setSucceeded(false);
                    return;
                }
                Packet futurePacket = new FuturePacket(obj, packet, priority,
                        future);
                boolean firstSend = false;
                boolean sendFailed = false;

                synchronized (sendQueue) {
View Full Code Here

TOP

Related Classes of net.sf.cindy.Packet

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.