public void reconnectSession ( final Session session , String reconnectKey ) throws InterruptedException , Exception { session . getTcpMessageSender ( ) . close ( ) ; if ( null != session . getUdpMessageSender ( ) ) session . getUdpMessageSender ( ) . close ( ) ; InetSocketAddress udpAddress = null ; if ( null != udpClient ) { udpAddress = doUdpConnection ( session ) ; } Event reconnectEvent = Events . event ( loginHelper . getReconnectBuffer ( reconnectKey , udpAddress ) , Events . RECONNECT ) ; doTcpConnection ( session , reconnectEvent ) ; }
Method used to reconnect existing session which probably got disconnected due to some exception . It will first close existing tcp and udp connections and then try re - connecting using the reconnect key from server .