private void connect() throws IOException {
  JMXServiceURL jmxUrl=new JMXServiceURL(String.format(FMTURL,host,host,port));
  Map<String,Object> env=new HashMap<String,Object>();
  if (username != null) {
    String[] creds={username,password};
    env.put(JMXConnector.CREDENTIALS,creds);
  }
  jmxc=JMXConnectorFactory.connect(jmxUrl,env);
  mbeanServerConn=jmxc.getMBeanServerConnection();
  try {
    ObjectName name=new ObjectName(SSOBJNAME);
    ssProxy=JMX.newMBeanProxy(mbeanServerConn,name,StorageServiceMBean.class);
    snitchProxy=JMX.newMBeanProxy(mbeanServerConn,new ObjectName("org.apache.cassandra.db:type=EndpointSnitchInfo"),EndpointSnitchInfoMBean.class);
    internodeAuthProxy=JMX.newMBeanProxy(mbeanServerConn,new ObjectName(GeoInternodeAuthenticatorMBean.MBEAN_NAME),GeoInternodeAuthenticatorMBean.class);
    dbMgrOps=new DbManagerOps(mbeanServerConn);
  }
 catch (  MalformedObjectNameException e) {
    throw new RuntimeException("Invalid ObjectName? Please report this as a bug.",e);
  }
}

private void connect ( ) throws IOException { JMXServiceURL jmxUrl = new JMXServiceURL ( String . format ( FMTURL , host , host , port ) ) ; Map < String , Object > env = new HashMap < String , Object > ( ) ; if ( username != null ) { String [ ] creds = { username , password } ; env . put ( JMXConnector . CREDENTIALS , creds ) ; } jmxc = JMXConnectorFactory . connect ( jmxUrl , env ) ; mbeanServerConn = jmxc . getMBeanServerConnection ( ) ; try { ObjectName name = new ObjectName ( SSOBJNAME ) ; ssProxy = JMX . newMBeanProxy ( mbeanServerConn , name , StorageServiceMBean . class ) ; snitchProxy = JMX . newMBeanProxy ( mbeanServerConn , new ObjectName ( "org.apache.cassandra.db:type=EndpointSnitchInfo" ) , EndpointSnitchInfoMBean . class ) ; internodeAuthProxy = JMX . newMBeanProxy ( mbeanServerConn , new ObjectName ( GeoInternodeAuthenticatorMBean . MBEAN_NAME ) , GeoInternodeAuthenticatorMBean . class ) ; dbMgrOps = new DbManagerOps ( mbeanServerConn ) ; } catch ( MalformedObjectNameException e ) { throw new RuntimeException ( "Invalid ObjectName? Please report this as a bug." , e ) ; } }
create a connection to the jmx agent and setup the m [ x ] bean proxies .
