Package org.apache.mina.filter.codec

Examples of org.apache.mina.filter.codec.ProtocolDecoder


            }
        };
    }

    public ProtocolDecoder getDecoder() throws Exception {
        return new ProtocolDecoder() {
            public void decode(IoSession session, ByteBuffer in, ProtocolDecoderOutput out) throws Exception {
                // convert to bytes to write, we can not pass in the byte buffer as it could be sent to
                // multiple mina sessions so we must convert it to bytes
                byte[] bytes = context.getTypeConverter().convertTo(byte[].class, in);
                out.write(bytes);
View Full Code Here


            };

        }

        public ProtocolDecoder getDecoder() throws Exception {
            return new ProtocolDecoder() {
                public void decode(IoSession ioSession, ByteBuffer in,
                                   ProtocolDecoderOutput out) throws Exception {
                    // close session instead of returning a reply
                    ioSession.close();
                }
View Full Code Here

            }
        };
    }

    public ProtocolDecoder getDecoder() throws Exception {
        return new ProtocolDecoder() {
            public void decode(IoSession session, ByteBuffer in,
                               ProtocolDecoderOutput out) throws Exception {
                // convert to bytes to write, we can not pass in the byte buffer
                // as it could be sent to multiple mina sessions so we must convert it to bytes
                byte[] bytes = context.getTypeConverter().mandatoryConvertTo(byte[].class, in);
View Full Code Here

            };

        }

        public ProtocolDecoder getDecoder() throws Exception {
            return new ProtocolDecoder() {
                public void decode(IoSession ioSession, ByteBuffer in,
                                   ProtocolDecoderOutput out) throws Exception {
                    // close session instead of returning a reply
                    ioSession.close();
                }
View Full Code Here

            }
        };
    }

    public ProtocolDecoder getDecoder() throws Exception {
        return new ProtocolDecoder() {
            public void decode(IoSession session, ByteBuffer in, ProtocolDecoderOutput out) throws Exception {
                // convert to bytes to write, we can not pass in the byte buffer as it could be sent to
                // multiple mina sessions so we must convert it to bytes
                byte[] bytes = context.getTypeConverter().convertTo(byte[].class, in);
                out.write(bytes);
View Full Code Here

            };

        }

        public ProtocolDecoder getDecoder(IoSession session) throws Exception {
            return new ProtocolDecoder() {

                public void decode(IoSession ioSession, IoBuffer in,
                                   ProtocolDecoderOutput out) throws Exception {
                    // close session instead of returning a reply
                    ioSession.close(true);
View Full Code Here

  public ProtocolDecoder getDecoder(IoSession ioSession) throws Exception {
    synchronized (decoders) {//TODO: rewrite???
      if (decoders.containsKey(ioSession))
        return decoders.get(ioSession);
     
      ProtocolDecoder decoder = new RequestDecoder();
      decoders.put(ioSession, decoder);
     
      return decoder;
    }
  }
View Full Code Here

  public ProtocolDecoder getDecoder(IoSession ioSession) throws Exception {
    synchronized (decoders) {
      if (decoders.containsKey(ioSession))
        return decoders.get(ioSession);
     
      ProtocolDecoder decoder = new RequestDecoder();
      decoders.put(ioSession, decoder);
     
      return decoder;
    }
  }
View Full Code Here

            }
        };
    }

    public ProtocolDecoder getDecoder() throws Exception {
        return new ProtocolDecoder() {
            public void decode(IoSession session, ByteBuffer in, ProtocolDecoderOutput out) throws Exception {
                // convert to bytes to write, we can not pass in the byte buffer as it could be sent to
                // multiple mina sessions so we must convert it to bytes
                byte[] bytes = context.getTypeConverter().convertTo(byte[].class, in);
                out.write(bytes);
View Full Code Here

        Object actual = osis.readObject();
        assertEquals(expected, actual);

        // Test ProtocolDecoder
        ProtocolDecoder decoder = new ObjectSerializationDecoder();
        ProtocolCodecSession session = new ProtocolCodecSession();
        ProtocolDecoderOutput decoderOut = session.getDecoderOutput();
        decoder.decode(session, in.duplicate(), decoderOut);

        Assert.assertEquals(1, session.getDecoderOutputQueue().size());
        Assert.assertEquals(expected, session.getDecoderOutputQueue().poll());
    }
View Full Code Here

TOP

Related Classes of org.apache.mina.filter.codec.ProtocolDecoder

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.