@Test(timeout=60000) public void testIpcConnectTimeout() throws IOException { // start server Server server = new TestServer(1, true); InetSocketAddress addr = NetUtils.getConnectAddress(server); //Intentionally do not start server to get a connection timeout // start client Client.setConnectTimeout(conf, 100); Client client = new Client(LongWritable.class, conf); // set the rpc timeout to twice the MIN_SLEEP_TIME try { client.call(new LongWritable(RANDOM.nextLong()), addr, null, null, MIN_SLEEP_TIME*2, conf); fail("Expected an exception to have been thrown"); } catch (SocketTimeoutException e) { LOG.info("Get a SocketTimeoutException ", e); } client.stop(); }
@Test(timeout=60000) public void testIpcConnectTimeout() throws IOException { // start server Server server = new TestServer(1, true); InetSocketAddress addr = NetUtils.getConnectAddress(server); //Intentionally do not start server to get a connection timeout // start client Client.setConnectTimeout(conf, 100); Client client = new Client(LongWritable.class, conf); // set the rpc timeout to twice the MIN_SLEEP_TIME try { client.call(new LongWritable(RANDOM.nextLong()), addr, null, null, MIN_SLEEP_TIME*2, conf); fail("Expected an exception to have been thrown"); } catch (SocketTimeoutException e) { LOG.info("Get a SocketTimeoutException ", e); } client.stop(); }
server.start(); Client.setConnectTimeout(conf, 10000);
server.start(); Client.setConnectTimeout(conf, 10000);
/** * Check service class byte in IPC header is correct on wire. */ @Test(timeout=60000) public void testIpcWithServiceClass() throws IOException { // start server Server server = new TestServer(5, false); InetSocketAddress addr = NetUtils.getConnectAddress(server); server.start(); // start client Client.setConnectTimeout(conf, 10000); callAndVerify(server, addr, 0, true); // Service Class is low to -128 as byte on wire. // -128 shouldn't be casted on wire but -129 should. callAndVerify(server, addr, -128, true); callAndVerify(server, addr, -129, false); // Service Class is up to 127. // 127 shouldn't be casted on wire but 128 should. callAndVerify(server, addr, 127, true); callAndVerify(server, addr, 128, false); server.stop(); }
/** * Check service class byte in IPC header is correct on wire. */ @Test(timeout=60000) public void testIpcWithServiceClass() throws IOException { // start server Server server = new TestServer(5, false); InetSocketAddress addr = NetUtils.getConnectAddress(server); server.start(); // start client Client.setConnectTimeout(conf, 10000); callAndVerify(server, addr, 0, true); // Service Class is low to -128 as byte on wire. // -128 shouldn't be casted on wire but -129 should. callAndVerify(server, addr, -128, true); callAndVerify(server, addr, -129, false); // Service Class is up to 127. // 127 shouldn't be casted on wire but 128 should. callAndVerify(server, addr, 127, true); callAndVerify(server, addr, 128, false); server.stop(); }