code: public void close() {
  		stopped = true;
  		try {
  			if (logger.isDebugEnabled()) {
  				logger.debug("Closing socket");
  			}
  			// selector.close();
  			socket.close();
  
  			if (this.channel != null) {
  				this.channel.close();
  			}
  
  			for(int i=0;i<decodingThreads.length;i++) {
  				decodingThreads[i].shutdown();
  			}
  			
  		} catch (Exception e) {
  			if(logger.isErrorEnabled())
  			{
  				logger.error("Could not gracefully close socket", e);
  			}
  		}
  	}
docs: Closes the stack and it's underlying resources.