code: @Override
      public synchronized void close() throws IOException {
          if (logger.isLoggable(Level.FINER)) {
              logger.logp(Level.FINER, logger.getName(), "close", "Closing connector");
          }
  
          if (!closed) {
              // It is possible for close to be called prior to connecting.
              // If so, we behave as a no-op.
              if (connection != null) {
                  connection.close();
              }
              connection = null;
              closed = true;
              if (connectionListeners != null) {
                  JMXConnectionNotification notification = new JMXConnectionNotification(JMXConnectionNotification.CLOSED, this, getConnectionId(), getNotificationNumber(), null, null);
                  for (NotificationListenerEntry entry : connectionListeners)
                      entry.handleNotification(notification);
              }
          }
      }
docs: {@inheritDoc}