Telnet Server example
"이희승 (Trustin Lee)"
trustin at gmail.com
Mon Jul 12 04:08:31 EDT 2010
Hi,
The pipeline() call is possible due to the static imports. You can
safely replace it with Channels.pipeline().
If your pipeline factory, you specified only one handler instead of
four. Therefore you will get the exception you reported. You need to
add proper decoders and encoders as you see from the
TelnetServerPipelineFactory.
HTH,
Trustin
On 07/09/2010 06:13 PM, nino martinez wael wrote:
> 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
>
>
>
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users
--
what we call human nature in actuality is human habit
http://gleamynode.net/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 293 bytes
Desc: OpenPGP digital signature
Url : http://lists.jboss.org/pipermail/netty-users/attachments/20100712/f1422530/attachment.bin
More information about the netty-users
mailing list