Hi Mike, If you write an IoBuffer, ProtocolCodecFilter assumes it's already encoded, and therefore your ProtocolEncoder.encode() is never called. You could wrap the IoBuffer with some other type.
HTH,
MikeD wrote:
> Hi all,
>
> I’m new tomina so appologies if this is documented somewhere.
>
> I have aclient and server sending IoBuffer’s back and forth.
>
> And now Iwant to make sure I get one message for each message sent so I
> implement the ProtocolCodec Filter from the image Server example. (In the
> encode I want to make a newIoBuffer with the length of the message at the
> start because my messages areall arbitary length, to allow the decode to do
> its job)
>
> But encodeis never called, but decode is (soencode never gets to add the 4
> bytes of length to the start)
>
> I thenchanged the imageServer/imgaeClient to send IoBuffers instead of
> ImageRequestObjects and that now never calls encode.
>
> ImageClient.javasendRequest becomes
>
>
> public void sendRequest(ImageRequestimageRequest) {
> if (session == null) {
> //noinspectionThrowableInstanceNeverThrown
> imageListener.onException(newThrowable("not connected"));
> } else {
> IoBuffer buf=IoBuffer.allocate(12);
> buf.putInt(10);
> buf.putInt(20);
> buf.putInt(30);
> buf.flip();
> session.write(buf);
> }
> }
>
>
> Am I doingsomething wrong? Why does the type of the message matter for
> callingencode/decode.
>
>
> MikeDiskett.
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
--
Trustin Lee - Principal Software Engineer, JBoss, Red Hat
--
what we call human nature is actually human habit
--
http://gleamynode.net/
signature.asc
Description: OpenPGP digital signature
