users@grizzly.java.net

Re: Issue with TunnelFilter and StringFilter example

From: Oleksiy Stashok <oleksiy.stashok_at_oracle.com>
Date: Mon, 12 Sep 2011 11:22:20 +0200

Hi,

can you pls. share the entire project sources, or at least part of it so
we can reproduce the problem?
What are you using as peer?

Thanks.

WBR,
Alexey.

On 09/11/2011 07:12 PM, donald.walters_at_gmail.com wrote:
> I created a filter chain which includes a StringFilter and the
> TunnelFilter example but for some reason the redirecttoPeer method in
> the TunnelFilter is not working.
>
> filterChainBuilder.add(new StringFilter(Charset.defaultCharset(),
> "</jps>"));
> filterChainBuilder.add(new
> TunnelFilter(TCPNIOConnectorHandler.builder(transport).build(),
> remoteHost, remotePort));
>
> ....
>
> in the TunnelFilter
>
> private static void redirectToPeer(FilterChainContext context,
> Connection peerConnection)
> throws IOException {
> Connection srcConnection = context.getConnection();
> logger.debug("Proxying messaging from " +
> srcConnection.getPeerAddress() + " to " +
> peerConnection.getPeerAddress());
>
> String message = context.getMessage();
> logger.debug(message);
>
> peerConnection.write(message);
>
> }
>
> when that method is called nothing happens. I see the output and the
> messages are ok but nothing is passed to the peer. Please let me know
> what I am doing wrong here.