title: Basic authenticator with Netty
body: <p>Actually for my server game I'm not using Netty. I've created a socket multithreaded system for send packet object who is serialized into and deserialized from (Int and Out)StreamBuffer.</p>
  
  <p>I've discovered Netty and I think it's better to use it for my network system.
  I've actually created a Client and Server handler (both extends ChannelInboundHandlerAdapter) to serialized and deserialized my packet from the ByteBuf, it's work FINE :) !</p>
  
  <p>Now I want migrate my authentication system.
  Actually, I've two Handler, the LoginHandler which can receive and process only the Login Packet (defined by an id when I send a buffer packet), and the ServerHandler which can receive and process all others packets.</p>
  
  <h2>Actual algorithme</h2>
  
  <ul>
  <li>Client side : 
  
  <ol>
  <li>User launch a client a new window ask him to enter his username and password When he click on "Login", the client connect to the server, and after send a LoginPacket.</li>
  <li>If a AuthServerPacket is sent by the server with the auth flag to true, he continue and open all others features.</li>
  <li>If a AuthServerPacket is sent by the server with the auth flag to false, it display a popup with the reason, and re-open the window login.</li>
  </ol></li>
  <li>Server side :
  
  <ol>
  <li>When a user is connecting to the server it's the LoginHandler which is attached to the client.</li>
  <li>In this LoginHandler, only LoginPacket is processed, so, when it receive a LoginPacket it check the informations in a database, if these are correct, the client are added to the ServerHandler and deleted from the LoginHandler, and now he can receive and send all others packets.</li>
  <li>ServerHandler send a AuthServerPacket with auth flag to true.</li>
  </ol></li>
  </ul>
  
  <p>My question is, what is the best way to re-create this system with Netty ?</p>
  
  <p>I don't know if I can add the login handler in the pipeline which it will be not check it if a channel is authentified. I don't know how or if the process is stopped if one of the handler reject the channel.</p>
  
  <p>Someone can help me to understand what is the best way to do what I want with Netty ?</p>
  
  <p>Thanks you in advance for your answers.<br />
  Programmatically, beaucoralk.</p>