HMaster hm = new HMaster(conf);
ServerName sm = hm.getServerName();
InetSocketAddress isa = new InetSocketAddress(sm.getHostname(), sm.getPort());
RpcEngine rpcEngine = null;
try {
rpcEngine = HBaseRPC.getProtocolEngine(conf);
HMasterInterface inf = rpcEngine.getProxy(
HMasterInterface.class, HMasterInterface.VERSION, isa, conf, 100 * 10);
inf.isMasterRunning();
fail();
} catch (RemoteException ex) {
assertTrue(ex.getMessage().startsWith(
"org.apache.hadoop.hbase.ipc.ServerNotRunningYetException: Server is not running yet"));
} catch (Throwable t) {
fail("Unexpected throwable: " + t);
} finally {
if (rpcEngine != null) {
rpcEngine.close();
}
}
}