package Ġio . open future . chain . network . config Ċ Ċ import Ġio . netty . bootstrap . Bootstrap Ċ import Ġio . netty . bootstrap . Server Bootstrap Ċ import Ġio . netty . channel . Channel Option .* Ċ import Ġio . netty . channel . nio . Nio EventLoop Group Ċ import Ġio . netty . channel . socket . nio . Nio Server SocketChannel Ċ import Ġio . netty . channel . socket . nio . Nio SocketChannel Ċ import Ġio . open future . chain . network . handler . network . initializer . Client Channel Initializer Ċ import Ġio . open future . chain . network . handler . network . initializer . Server Channel Initializer Ċ import Ġio . open future . chain . network . property . Node Properties Ċ import Ġorg . apache . commons . net . ntp . N TP UDP Client Ċ import Ġorg . springframework . context . annotation . Bean Ċ import Ġorg . springframework . context . annotation . Configuration Ċ import Ġjava . util . concurrent . Executors Ċ import Ġjava . util . concurrent . Scheduled ExecutorService Ċ Ċ @ Configuration Ċ class ĠNet ty Config ( ĊĠĠĠ Ġprivate Ġval Ġserver Channel Initializer : ĠServer Channel Initializer , ĊĠĠĠ Ġprivate Ġval Ġclient Channel Initializer : ĠClient Channel Initializer , ĊĠĠĠ Ġprivate Ġval Ġproperties : ĠNode Properties Ċ ) Ġ{ ĊĊĠĠĠ Ġ@ Bean ĊĠĠĠ Ġfun Ġtask Scheduler (): ĠScheduled ExecutorService Ġ= ĠExec utors . new Scheduled ThreadPool ( 5 ) ĊĊĠĠĠ Ġ@ Bean ( destroy Method Ġ= Ġ" shutdown Grace fully ") ĊĠĠĠ Ġfun Ġboss Group (): ĠN io EventLoop Group Ġ= ĠN io EventLoop Group () ĊĊĠĠĠ Ġ@ Bean ( destroy Method Ġ= Ġ" shutdown Grace fully ") ĊĠĠĠ Ġfun Ġworker Group (): ĠN io EventLoop Group Ġ= ĠN io EventLoop Group () ĊĊĠĠĠ Ġ@ Bean ĊĠĠĠ Ġfun Ġserver Bootstrap (): ĠServer Bootstrap Ġ= ĠServer Bootstrap () ĊĠĠĠĠĠĠĠ Ġ. group ( boss Group (), Ġworker Group ()) ĊĠĠĠĠĠĠĠ Ġ. channel ( Nio Server SocketChannel :: class . java ) ĊĠĠĠĠĠĠĠ Ġ. child Handler ( server Channel Initializer ) ĊĠĠĠĠĠĠĠ Ġ. option ( SO _ BACK LOG , Ġproperties . back log !! ) ĊĠĠĠĠĠĠĠ Ġ. child Option ( SO _ KEEP AL IVE , Ġproperties . keep Alive !! ) ĊĠĠĠĠĠĠĠ Ġ. child Option ( CONNECT _ TIMEOUT _ M ILL IS , Ġproperties . connection Timeout !! ) ĊĊĠĠĠ Ġ@ Bean ĊĠĠĠ Ġfun Ġclient Bootstrap (): ĠBootstrap Ġ= ĠBootstrap () ĊĠĠĠĠĠĠĠ Ġ. group ( worker Group ()) ĊĠĠĠĠĠĠĠ Ġ. channel ( Nio SocketChannel :: class . java ) ĊĠĠĠĠĠĠĠ Ġ. handler ( client Channel Initializer ) ĊĠĠĠĠĠĠĠ Ġ. option ( SO _ KEEP AL IVE , Ġproperties . keep Alive !! ) ĊĊĠĠĠ Ġ@ Bean ĊĠĠĠ Ġfun Ġn tp Client (): ĠN TP UDP Client Ġ= ĠN TP UDP Client (). apply Ġ{ Ġdefault Timeout Ġ= Ġ 3 0 0 0 Ġ} Ċ Ċ }