Fix examples

This commit is contained in:
Norman Maurer 2013-05-06 10:27:06 +02:00
parent 108c7d9b44
commit 17e5049194
8 changed files with 10 additions and 17 deletions

View File

@ -16,7 +16,6 @@
package io.netty.example.filetransfer;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.buffer.BufType;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundMessageHandlerAdapter;
@ -66,7 +65,7 @@ public class FileServer {
@Override
public void initChannel(SocketChannel ch) throws Exception {
ch.pipeline().addLast(
new StringEncoder(BufType.BYTE, CharsetUtil.UTF_8),
new StringEncoder(CharsetUtil.UTF_8),
new LineBasedFrameDecoder(8192),
new StringDecoder(CharsetUtil.UTF_8),
new FileHandler());

View File

@ -16,7 +16,6 @@
package io.netty.example.rxtx;
import io.netty.bootstrap.Bootstrap;
import io.netty.buffer.BufType;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.EventLoopGroup;
@ -43,7 +42,7 @@ public final class RxtxClient {
public void initChannel(RxtxChannel ch) throws Exception {
ch.pipeline().addLast(
new LineBasedFrameDecoder(32768),
new StringEncoder(BufType.BYTE),
new StringEncoder(),
new StringDecoder(),
new RxtxClientHandler()
);

View File

@ -15,7 +15,6 @@
*/
package io.netty.example.securechat;
import io.netty.buffer.BufType;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
@ -52,7 +51,7 @@ public class SecureChatClientInitializer extends ChannelInitializer<SocketChanne
pipeline.addLast("framer", new DelimiterBasedFrameDecoder(
8192, Delimiters.lineDelimiter()));
pipeline.addLast("decoder", new StringDecoder());
pipeline.addLast("encoder", new StringEncoder(BufType.BYTE));
pipeline.addLast("encoder", new StringEncoder());
// and then business logic.
pipeline.addLast("handler", new SecureChatClientHandler());

View File

@ -15,7 +15,6 @@
*/
package io.netty.example.securechat;
import io.netty.buffer.BufType;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
@ -55,7 +54,7 @@ public class SecureChatServerInitializer extends ChannelInitializer<SocketChanne
pipeline.addLast("framer", new DelimiterBasedFrameDecoder(
8192, Delimiters.lineDelimiter()));
pipeline.addLast("decoder", new StringDecoder());
pipeline.addLast("encoder", new StringEncoder(BufType.BYTE));
pipeline.addLast("encoder", new StringEncoder());
// and then business logic.
pipeline.addLast("handler", new SecureChatServerHandler());

View File

@ -15,7 +15,6 @@
*/
package io.netty.example.telnet;
import io.netty.buffer.BufType;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
@ -29,7 +28,7 @@ import io.netty.handler.codec.string.StringEncoder;
*/
public class TelnetClientInitializer extends ChannelInitializer<SocketChannel> {
private static final StringDecoder DECODER = new StringDecoder();
private static final StringEncoder ENCODER = new StringEncoder(BufType.BYTE);
private static final StringEncoder ENCODER = new StringEncoder();
private static final TelnetClientHandler CLIENTHANDLER = new TelnetClientHandler();
@Override
public void initChannel(SocketChannel ch) throws Exception {

View File

@ -15,7 +15,6 @@
*/
package io.netty.example.telnet;
import io.netty.buffer.BufType;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
@ -29,7 +28,7 @@ import io.netty.handler.codec.string.StringEncoder;
*/
public class TelnetServerPipelineFactory extends ChannelInitializer<SocketChannel> {
private static final StringDecoder DECODER = new StringDecoder();
private static final StringEncoder ENCODER = new StringEncoder(BufType.BYTE);
private static final StringEncoder ENCODER = new StringEncoder();
private static final TelnetServerHandler SERVERHANDLER = new TelnetServerHandler();
@Override

View File

@ -17,7 +17,6 @@ package io.netty.testsuite.transport.socket;
import io.netty.bootstrap.Bootstrap;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.buffer.BufType;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundMessageHandlerAdapter;
@ -77,7 +76,7 @@ public class SocketStartTlsTest extends AbstractSocketTest {
public void initChannel(SocketChannel sch) throws Exception {
ChannelPipeline p = sch.pipeline();
p.addLast("logger", new ByteLoggingHandler(LOG_LEVEL));
p.addLast(new LineBasedFrameDecoder(64), new StringDecoder(), new StringEncoder(BufType.BYTE));
p.addLast(new LineBasedFrameDecoder(64), new StringDecoder(), new StringEncoder());
p.addLast(executor, sh);
}
});
@ -87,7 +86,7 @@ public class SocketStartTlsTest extends AbstractSocketTest {
public void initChannel(SocketChannel sch) throws Exception {
ChannelPipeline p = sch.pipeline();
p.addLast("logger", new ByteLoggingHandler(LOG_LEVEL));
p.addLast(new LineBasedFrameDecoder(64), new StringDecoder(), new StringEncoder(BufType.BYTE));
p.addLast(new LineBasedFrameDecoder(64), new StringDecoder(), new StringEncoder());
p.addLast(executor, ch);
}
});

View File

@ -67,7 +67,7 @@ public class SocketStringEchoTest extends AbstractSocketTest {
public void initChannel(SocketChannel sch) throws Exception {
sch.pipeline().addLast("framer", new DelimiterBasedFrameDecoder(512, Delimiters.lineDelimiter()));
sch.pipeline().addLast("decoder", new StringDecoder(CharsetUtil.ISO_8859_1));
sch.pipeline().addBefore("decoder", "encoder", new StringEncoder(BufType.BYTE, CharsetUtil.ISO_8859_1));
sch.pipeline().addBefore("decoder", "encoder", new StringEncoder(CharsetUtil.ISO_8859_1));
sch.pipeline().addAfter("decoder", "handler", sh);
}
});
@ -77,7 +77,7 @@ public class SocketStringEchoTest extends AbstractSocketTest {
public void initChannel(SocketChannel sch) throws Exception {
sch.pipeline().addLast("framer", new DelimiterBasedFrameDecoder(512, Delimiters.lineDelimiter()));
sch.pipeline().addLast("decoder", new StringDecoder(CharsetUtil.ISO_8859_1));
sch.pipeline().addBefore("decoder", "encoder", new StringEncoder(BufType.BYTE, CharsetUtil.ISO_8859_1));
sch.pipeline().addBefore("decoder", "encoder", new StringEncoder(CharsetUtil.ISO_8859_1));
sch.pipeline().addAfter("decoder", "handler", ch);
}
});