thufir

Untitled

Jul 26th, 2014
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.85 KB | None | 0 0
  1. package io.netty.example.objectecho;
  2.  
  3. import io.netty.channel.ChannelHandlerContext;
  4. import io.netty.channel.SimpleChannelInboundHandler;
  5. import java.util.logging.Logger;
  6. import net.bounceme.dur.client.jdbc.Title;
  7.  
  8. public class ServerHandler extends SimpleChannelInboundHandler<Title> {
  9.  
  10.     private static final Logger log = Logger.getLogger(ServerHandler.class.getName());
  11.  
  12.     @Override
  13.     public boolean acceptInboundMessage(Object msg) throws Exception {
  14.         return true;
  15.     }
  16.  
  17.     @Override
  18.     public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
  19.         log.info(msg.toString());
  20.         ctx.write(new Title());
  21.     }
  22.  
  23.     @Override
  24.     protected void channelRead0(ChannelHandlerContext chc, Title title) throws Exception {
  25.         log.info(title.toString());
  26.         chc.write(new Title());
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment