code: public static JMXConnector connect(int port) throws IOException {
  		String url = "service:jmx:rmi:///jndi/rmi://127.0.0.1:" + port + "/jmxrmi";
  		JMXServiceURL serviceUrl = new JMXServiceURL(url);
  		return JMXConnectorFactory.connect(serviceUrl, null);
  	}
docs: Create a connector for an {@link javax.management.MBeanServer} exposed on the
  current machine and the current port. Security should be disabled.
  @param port the port on which the mbean server is exposed
  @return a connection
  @throws IOException if the connection to that server failed