Skip to content

Commit 17e5049

Browse files
author
Norman Maurer
committed
Fix examples
1 parent 108c7d9 commit 17e5049

8 files changed

Lines changed: 10 additions & 17 deletions

File tree

example/src/main/java/io/netty/example/filetransfer/FileServer.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
package io.netty.example.filetransfer;
1717

1818
import io.netty.bootstrap.ServerBootstrap;
19-
import io.netty.buffer.BufType;
2019
import io.netty.channel.ChannelFuture;
2120
import io.netty.channel.ChannelHandlerContext;
2221
import io.netty.channel.ChannelInboundMessageHandlerAdapter;
@@ -66,7 +65,7 @@ public void run() throws Exception {
6665
@Override
6766
public void initChannel(SocketChannel ch) throws Exception {
6867
ch.pipeline().addLast(
69-
new StringEncoder(BufType.BYTE, CharsetUtil.UTF_8),
68+
new StringEncoder(CharsetUtil.UTF_8),
7069
new LineBasedFrameDecoder(8192),
7170
new StringDecoder(CharsetUtil.UTF_8),
7271
new FileHandler());

example/src/main/java/io/netty/example/rxtx/RxtxClient.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
package io.netty.example.rxtx;
1717

1818
import io.netty.bootstrap.Bootstrap;
19-
import io.netty.buffer.BufType;
2019
import io.netty.channel.ChannelFuture;
2120
import io.netty.channel.ChannelInitializer;
2221
import io.netty.channel.EventLoopGroup;
@@ -43,7 +42,7 @@ public static void main(String[] args) throws Exception {
4342
public void initChannel(RxtxChannel ch) throws Exception {
4443
ch.pipeline().addLast(
4544
new LineBasedFrameDecoder(32768),
46-
new StringEncoder(BufType.BYTE),
45+
new StringEncoder(),
4746
new StringDecoder(),
4847
new RxtxClientHandler()
4948
);

example/src/main/java/io/netty/example/securechat/SecureChatClientInitializer.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616
package io.netty.example.securechat;
1717

18-
import io.netty.buffer.BufType;
1918
import io.netty.channel.ChannelInitializer;
2019
import io.netty.channel.ChannelPipeline;
2120
import io.netty.channel.socket.SocketChannel;
@@ -52,7 +51,7 @@ public void initChannel(SocketChannel ch) throws Exception {
5251
pipeline.addLast("framer", new DelimiterBasedFrameDecoder(
5352
8192, Delimiters.lineDelimiter()));
5453
pipeline.addLast("decoder", new StringDecoder());
55-
pipeline.addLast("encoder", new StringEncoder(BufType.BYTE));
54+
pipeline.addLast("encoder", new StringEncoder());
5655

5756
// and then business logic.
5857
pipeline.addLast("handler", new SecureChatClientHandler());

example/src/main/java/io/netty/example/securechat/SecureChatServerInitializer.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616
package io.netty.example.securechat;
1717

18-
import io.netty.buffer.BufType;
1918
import io.netty.channel.ChannelInitializer;
2019
import io.netty.channel.ChannelPipeline;
2120
import io.netty.channel.socket.SocketChannel;
@@ -55,7 +54,7 @@ public void initChannel(SocketChannel ch) throws Exception {
5554
pipeline.addLast("framer", new DelimiterBasedFrameDecoder(
5655
8192, Delimiters.lineDelimiter()));
5756
pipeline.addLast("decoder", new StringDecoder());
58-
pipeline.addLast("encoder", new StringEncoder(BufType.BYTE));
57+
pipeline.addLast("encoder", new StringEncoder());
5958

6059
// and then business logic.
6160
pipeline.addLast("handler", new SecureChatServerHandler());

example/src/main/java/io/netty/example/telnet/TelnetClientInitializer.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616
package io.netty.example.telnet;
1717

18-
import io.netty.buffer.BufType;
1918
import io.netty.channel.ChannelInitializer;
2019
import io.netty.channel.ChannelPipeline;
2120
import io.netty.channel.socket.SocketChannel;
@@ -29,7 +28,7 @@
2928
*/
3029
public class TelnetClientInitializer extends ChannelInitializer<SocketChannel> {
3130
private static final StringDecoder DECODER = new StringDecoder();
32-
private static final StringEncoder ENCODER = new StringEncoder(BufType.BYTE);
31+
private static final StringEncoder ENCODER = new StringEncoder();
3332
private static final TelnetClientHandler CLIENTHANDLER = new TelnetClientHandler();
3433
@Override
3534
public void initChannel(SocketChannel ch) throws Exception {

example/src/main/java/io/netty/example/telnet/TelnetServerPipelineFactory.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616
package io.netty.example.telnet;
1717

18-
import io.netty.buffer.BufType;
1918
import io.netty.channel.ChannelInitializer;
2019
import io.netty.channel.ChannelPipeline;
2120
import io.netty.channel.socket.SocketChannel;
@@ -29,7 +28,7 @@
2928
*/
3029
public class TelnetServerPipelineFactory extends ChannelInitializer<SocketChannel> {
3130
private static final StringDecoder DECODER = new StringDecoder();
32-
private static final StringEncoder ENCODER = new StringEncoder(BufType.BYTE);
31+
private static final StringEncoder ENCODER = new StringEncoder();
3332
private static final TelnetServerHandler SERVERHANDLER = new TelnetServerHandler();
3433

3534
@Override

testsuite/src/test/java/io/netty/testsuite/transport/socket/SocketStartTlsTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
import io.netty.bootstrap.Bootstrap;
1919
import io.netty.bootstrap.ServerBootstrap;
20-
import io.netty.buffer.BufType;
2120
import io.netty.channel.Channel;
2221
import io.netty.channel.ChannelHandlerContext;
2322
import io.netty.channel.ChannelInboundMessageHandlerAdapter;
@@ -77,7 +76,7 @@ public void testStartTls(ServerBootstrap sb, Bootstrap cb) throws Throwable {
7776
public void initChannel(SocketChannel sch) throws Exception {
7877
ChannelPipeline p = sch.pipeline();
7978
p.addLast("logger", new ByteLoggingHandler(LOG_LEVEL));
80-
p.addLast(new LineBasedFrameDecoder(64), new StringDecoder(), new StringEncoder(BufType.BYTE));
79+
p.addLast(new LineBasedFrameDecoder(64), new StringDecoder(), new StringEncoder());
8180
p.addLast(executor, sh);
8281
}
8382
});
@@ -87,7 +86,7 @@ public void initChannel(SocketChannel sch) throws Exception {
8786
public void initChannel(SocketChannel sch) throws Exception {
8887
ChannelPipeline p = sch.pipeline();
8988
p.addLast("logger", new ByteLoggingHandler(LOG_LEVEL));
90-
p.addLast(new LineBasedFrameDecoder(64), new StringDecoder(), new StringEncoder(BufType.BYTE));
89+
p.addLast(new LineBasedFrameDecoder(64), new StringDecoder(), new StringEncoder());
9190
p.addLast(executor, ch);
9291
}
9392
});

testsuite/src/test/java/io/netty/testsuite/transport/socket/SocketStringEchoTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public void testStringEcho(ServerBootstrap sb, Bootstrap cb) throws Throwable {
6767
public void initChannel(SocketChannel sch) throws Exception {
6868
sch.pipeline().addLast("framer", new DelimiterBasedFrameDecoder(512, Delimiters.lineDelimiter()));
6969
sch.pipeline().addLast("decoder", new StringDecoder(CharsetUtil.ISO_8859_1));
70-
sch.pipeline().addBefore("decoder", "encoder", new StringEncoder(BufType.BYTE, CharsetUtil.ISO_8859_1));
70+
sch.pipeline().addBefore("decoder", "encoder", new StringEncoder(CharsetUtil.ISO_8859_1));
7171
sch.pipeline().addAfter("decoder", "handler", sh);
7272
}
7373
});
@@ -77,7 +77,7 @@ public void initChannel(SocketChannel sch) throws Exception {
7777
public void initChannel(SocketChannel sch) throws Exception {
7878
sch.pipeline().addLast("framer", new DelimiterBasedFrameDecoder(512, Delimiters.lineDelimiter()));
7979
sch.pipeline().addLast("decoder", new StringDecoder(CharsetUtil.ISO_8859_1));
80-
sch.pipeline().addBefore("decoder", "encoder", new StringEncoder(BufType.BYTE, CharsetUtil.ISO_8859_1));
80+
sch.pipeline().addBefore("decoder", "encoder", new StringEncoder(CharsetUtil.ISO_8859_1));
8181
sch.pipeline().addAfter("decoder", "handler", ch);
8282
}
8383
});

0 commit comments

Comments
 (0)