EsotericSoftware / kryonetty

Client/server library for Java, based on Netty and Kryo
67 stars 22 forks source link

Version port from Netty 3.4.4 to Netty 4.1 #2

Closed seii closed 4 years ago

seii commented 4 years ago

Ported kryonetty from Netty 3.x to 4.1.

I realize that kryonetty isn't a currently maintained package, but I happen to use Kryonet + Netty for another project and thought I'd pass along what I learned after trying to use Kryonetty as a base for my own efforts.

I have attempted to keep all classes and files as similar as possible, with no new tests added. I did make three notable changes to the class structure:

  1. Client and Server handlers and initializers are separated into different classes and denoted by name (This is how Netty writes their own examples)
  2. The Decoder and Encoder classes were also separated out into different classes instead of being part of the KryoChannelPipelineFactory as they were before (This is how Netty writes their own examples)
  3. Previously it was not possible in kryonetty to separate the creation of a Client or Server from the start of its network operations. Netty does already have these as two separate events (even in 3.x) so I've split network logic out from the constructors and created the methods Client.connect() and Server.start() instead

The diff (and Netty's own documentation) is going to be a more comprehensive description of all project changes, but I'll touch on a few that were directly relevant to this conversion:

Resources: Netty "New and Noteworthy in 4.0" document Netty "New and Noteworthy in 4.1" document

NathanSweet commented 4 years ago

I always wanted to put more effort into kryonetty, but never found the time. I'm happy to include your contributions! Cheers!