Telnet Server example

nino martinez wael nino.martinez.wael at gmail.com
Fri Jul 9 05:24:15 EDT 2010


Hehe missed the static import :

*import* *static* org.jboss.netty.channel.Channels.*;

:)


It's working perfectly now.

regards Nino

2010/7/9 nino martinez wael <nino.martinez.wael at gmail.com>

> Hi
>
> First of all thanks for creating netty. Havent been using it much but
> looking forward to do so.
>
> I am trying to get the Telnet example working but am a bit stuck here:
>
>
> http://docs.jboss.org/netty/3.2/xref/org/jboss/netty/example/telnet/TelnetServerPipelineFactory.html#41
> It shows this : ChannelPipeline<http://docs.jboss.org/netty/3.2/xref/org/jboss/netty/channel/ChannelPipeline.html>pipeline = pipeline();
>
> Which is not possible since there is no method called pipeline in the
> telnetserverpipelinefactory, so I tried this instead :
>
>     ChannelPipeline pipeline;
>         ChannelPipelineFactory channelPipelineFactory = new
> ChannelPipelineFactory() {
>             public ChannelPipeline getPipeline() throws Exception {
>                 return Channels.pipeline(new TelnetServerHandler());
>             }
>         };
>         pipeline = channelPipelineFactory.getPipeline();
>
> But when running the example I get an error :
>
> WARNING: Unexpected exception from downstream.
> java.lang.ClassCastException:
> org.jboss.netty.buffer.BigEndianHeapChannelBuffer cannot be cast to
> java.lang.String
>     at
> com.netdesign.sockethttpforwarder.TelnetServerHandler.messageReceived(TelnetServerHandler.java:47)
>     at
> com.netdesign.sockethttpforwarder.TelnetServerHandler.handleUpstream(TelnetServerHandler.java:28)
>     at
> org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:274)
>     at
> org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:261)
>     at
> org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:349)
>     at
> org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:281)
>     at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:201)
>     at
> org.jboss.netty.util.internal.IoWorkerRunnable.run(IoWorkerRunnable.java:46)
>     at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>     at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>     at java.lang.Thread.run(Thread.java:619)
>
> Im seems that the String decoder has'nt registered correctly?
>
> regards Nino
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/netty-users/attachments/20100709/49c9efa0/attachment.html 


More information about the netty-users mailing list