ZooKeeperServerBean implements ZooKeeperServerMXBean, ZKMBeanInfo { @Override public String getSecureClientPort() { if (zks.secureServerCnxnFactory != null) { return Integer.toString(zks.secureServerCnxnFactory.getLocalPort()); } return ""; } ZooKeeperServerBean(ZooKeeperServer zks); String getClientPort(); String getName(); boolean isHidden(); String getStartTime(); String getVersion(); long getAvgRequestLatency(); long getMaxRequestLatency(); long getMinRequestLatency(); long getOutstandingRequests(); int getTickTime(); void setTickTime(int tickTime); int getMaxClientCnxnsPerHost(); void setMaxClientCnxnsPerHost(int max); int getMinSessionTimeout(); void setMinSessionTimeout(int min); int getMaxSessionTimeout(); void setMaxSessionTimeout(int max); long getDataDirSize(); long getLogDirSize(); long getPacketsReceived(); long getPacketsSent(); long getFsyncThresholdExceedCount(); void resetLatency(); void resetMaxLatency(); void resetFsyncThresholdExceedCount(); void resetStatistics(); long getNumAliveConnections(); @Override String getSecureClientPort(); @Override String getSecureClientAddress(); @Override long getTxnLogElapsedSyncTime(); @Override int getJuteMaxBufferSize(); @Override int getLastClientResponseSize(); @Override int getMinClientResponseSize(); @Override int getMaxClientResponseSize();  }
@Test public void testGetSecureClientPort() throws IOException { ZooKeeperServer zks = new ZooKeeperServer(); ZooKeeperServerBean serverBean = new ZooKeeperServerBean(zks); String result = serverBean.getSecureClientPort(); assertEquals("", result); ServerCnxnFactory cnxnFactory = ServerCnxnFactory.createFactory(); int secureClientPort = 8443; InetSocketAddress address = new InetSocketAddress(secureClientPort); cnxnFactory.configure(address, 5, true); zks.setSecureServerCnxnFactory(cnxnFactory); result = serverBean.getSecureClientPort(); assertEquals(Integer.toString(secureClientPort), result); cnxnFactory.shutdown(); }