diff --git a/example/src/main/java/io/netty/example/securechat/SecureChatServerHandler.java b/example/src/main/java/io/netty/example/securechat/SecureChatServerHandler.java index 5421956af3..0e599fbaf2 100644 --- a/example/src/main/java/io/netty/example/securechat/SecureChatServerHandler.java +++ b/example/src/main/java/io/netty/example/securechat/SecureChatServerHandler.java @@ -47,10 +47,10 @@ public class SecureChatServerHandler extends SimpleChannelInboundHandler new GenericFutureListener>() { @Override public void operationComplete(Future future) throws Exception { - ctx.write( + ctx.writeAndFlush( "Welcome to " + InetAddress.getLocalHost().getHostName() + " secure chat service!\n"); - ctx.write( + ctx.writeAndFlush( "Your session is protected by " + ctx.pipeline().get(SslHandler.class).engine().getSession().getCipherSuite() + " cipher suite.\n"); @@ -65,10 +65,10 @@ public class SecureChatServerHandler extends SimpleChannelInboundHandler // Send the received message to all channels but the current one. for (Channel c: channels) { if (c != ctx.channel()) { - c.write("[" + ctx.channel().remoteAddress() + "] " + + c.writeAndFlush("[" + ctx.channel().remoteAddress() + "] " + msg + '\n'); } else { - c.write("[you] " + msg + '\n'); + c.writeAndFlush("[you] " + msg + '\n'); } }