code: public void close()
      {
      	if (!manageSockets)
      		throw new IllegalStateException("Cannot close an un-managed socket factory");
      	
      	synchronized (createdSockets)
  		{
  	    	Iterator<ServerSocket> sockets = createdSockets.iterator();
  	    	while (sockets.hasNext())
  	    	{
  	    		ServerSocket socket = sockets.next();
  	    		try
  	    		{
  	    			socket.close();
  	    		}
  	    		catch (Exception e)
  	    		{
  	    			log.error("Could not close server socket",e);
  	    		}
  	    	}
  	    	createdSockets.clear();
  		}
      }
docs: Cleanup sockets created by this factory