On 8/21/06, peter royal <[EMAIL PROTECTED]> wrote:

On Aug 17, 2006, at 3:08 PM, Horace Pinker wrote:
> i'm using an acceptor and would like to manually post data to the
> in-queue of a connection. for the connection handler it should
> behave as if the connected client sent the data. is there an
> offical way to do this?
>
> i would like to do this so that the connection handler state
> machine receives data from the remote and from a local source in a
> consitent and ordered way.
>
> any suggestions are welcome.

You can achieve this by getting the start of the filter chain for
your connection, and just calling events on it (you want the
messageReceived event :)


Here's an example filter that fires a messageReceived event when connection
is open:

public class MyFilter extends IoFilterAdapter {
   public void sessionOpened(NextFilter next, IoSession session) throws
Exception {
       next.sessionOpened(session);
       next.messageReceived(session, <my message>);
   }
}

You could insert this filter in your configuration (IoServiceConfig).

HTH,
Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP key fingerprints:
* E167 E6AF E73A CBCE EE41  4A29 544D DE48 FE95 4E7E
* B693 628E 6047 4F8F CFA4  455E 1C62 A7DC 0255 ECA6

Reply via email to