void closeSocketImpl ( ) { this . currentServerURI = null ; // Signal the reader and writer this . reader . stop ( ) ; this . writer . stop ( ) ; // Close the current socket and cancel anyone waiting for it this . dataPortFuture . cancel ( true ) ; try { if ( this . dataPort != null ) { this . dataPort . close ( ) ; } } catch ( IOException ex ) { processException ( ex ) ; } cleanUpPongQueue ( ) ; // We signaled now wait for them to stop try { this . reader . stop ( ) . get ( 10 , TimeUnit . SECONDS ) ; } catch ( Exception ex ) { processException ( ex ) ; } try { this . writer . stop ( ) . get ( 10 , TimeUnit . SECONDS ) ; } catch ( Exception ex ) { processException ( ex ) ; } }
Should only be called from closeSocket or close