Examples of sendRpcSync()


Examples of org.apache.spark.network.client.TransportClient.sendRpcSync()

      Lists.<TransportClientBootstrap>newArrayList(
        new SaslClientBootstrap(conf, "app-id", new TestSecretKeyHolder("good-key"))));

    TransportClient client = clientFactory.createClient(TestUtils.getLocalHost(), server.getPort());
    String msg = "Hello, World!";
    byte[] resp = client.sendRpcSync(msg.getBytes(), 1000);
    assertEquals(msg, new String(resp)); // our rpc handler should just return the given msg
  }

  @Test
  public void testBadClient() {
View Full Code Here

Examples of org.apache.spark.network.client.TransportClient.sendRpcSync()

    clientFactory = context.createClientFactory(
      Lists.<TransportClientBootstrap>newArrayList());

    TransportClient client = clientFactory.createClient(TestUtils.getLocalHost(), server.getPort());
    try {
      client.sendRpcSync(new byte[13], 1000);
      fail("Should have failed");
    } catch (Exception e) {
      assertTrue(e.getMessage(), e.getMessage().contains("Expected SaslMessage"));
    }
View Full Code Here

Examples of org.apache.spark.network.client.TransportClient.sendRpcSync()

      assertTrue(e.getMessage(), e.getMessage().contains("Expected SaslMessage"));
    }

    try {
      // Guessing the right tag byte doesn't magically get you in...
      client.sendRpcSync(new byte[] { (byte) 0xEA }, 1000);
      fail("Should have failed");
    } catch (Exception e) {
      assertTrue(e.getMessage(), e.getMessage().contains("java.lang.IndexOutOfBoundsException"));
    }
  }
View Full Code Here

Examples of org.apache.spark.network.client.TransportClient.sendRpcSync()

      String execId,
      ExecutorShuffleInfo executorInfo) throws IOException {
    assert appId != null : "Called before init()";
    TransportClient client = clientFactory.createClient(host, port);
    byte[] registerMessage = new RegisterExecutor(appId, execId, executorInfo).toByteArray();
    client.sendRpcSync(registerMessage, 5000 /* timeoutMs */);
  }

  @Override
  public void close() {
    clientFactory.close();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.