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:
Client and Server handlers and initializers are separated into different classes and denoted by name (This is how Netty writes their own examples)
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)
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:
Netty packages now begin with io.netty instead of org.jboss.netty
ChannelPipelineFactory classes become ChannelInitializer classes
ChannelBuffer classes are now ByteBuf classes
Write operations within a Netty channel now require a flush() method call eventually, or the use of writeAndFlush() instead
Netty now uses EventLoopGroups instead of messing directly with Executor services
ChannelConfig.setOption() no longer uses Strings for option names, but Enum values instead
Bootstrap is now a fluent interface (and also changed ClientBootstrap to just Bootstrap)
FrameDecoder is now ByteToMessageDecoder
Most Netty method setters / getters have set... / get... removed (is... is not removed)
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:
KryoChannelPipelineFactory
as they were before (This is how Netty writes their own examples)Client
orServer
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 methodsClient.connect()
andServer.start()
insteadThe 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:
io.netty
instead oforg.jboss.netty
ChannelPipelineFactory
classes becomeChannelInitializer
classesChannelBuffer
classes are nowByteBuf
classesflush()
method call eventually, or the use ofwriteAndFlush()
insteadEventLoopGroup
s instead of messing directly with Executor servicesChannelConfig.setOption()
no longer uses Strings for option names, but Enum values insteadBootstrap
is now a fluent interface (and also changedClientBootstrap
to justBootstrap
)FrameDecoder
is nowByteToMessageDecoder
set...
/get...
removed (is...
is not removed)Resources: Netty "New and Noteworthy in 4.0" document Netty "New and Noteworthy in 4.1" document