code: public synchronized SocketBox checkOut() {
          Enumeration e = freeSockets.keys();
  
          if (e.hasMoreElements()) {
              SocketBox sb = (SocketBox)e.nextElement();
  
              if (busySockets.containsKey(sb)) {
                  throw new IllegalArgumentException("This socket is marked free, but already exists in the pool of busy sockets.");
              }
  
              ((ManagedSocketBox) sb).setStatus(ManagedSocketBox.BUSY);
              freeSockets.remove(sb);
              busySockets.put(sb, sb);
  
              return sb;
          } else {
              return null;
          }
      }
docs: checks out the next free socket and returns it, or returns null if there aren't any.
  Before calling this method, the socket needs to be first add()ed to the pool.