@Override protected BlockingRpcClient createRpcClientRTEDuringConnectionSetup(Configuration conf) throws IOException { return new BlockingRpcClient(conf) { @Override boolean isTcpNoDelay() { throw new RuntimeException("Injected fault"); } }; }
try { this.socket = this.rpcClient.socketFactory.createSocket(); this.socket.setTcpNoDelay(this.rpcClient.isTcpNoDelay()); this.socket.setKeepAlive(this.rpcClient.tcpKeepAlive); if (this.rpcClient.localAddr != null) {
protected AbstractRpcClient<?> createRpcClient(Configuration conf, boolean isSyncClient) { return isSyncClient ? new BlockingRpcClient(conf) : new NettyRpcClient(conf) { @Override Codec getCodec() { return null; } }; }
try { this.socket = this.rpcClient.socketFactory.createSocket(); this.socket.setTcpNoDelay(this.rpcClient.isTcpNoDelay()); this.socket.setKeepAlive(this.rpcClient.tcpKeepAlive); if (this.rpcClient.localAddr != null) {
@Override protected BlockingRpcClient createRpcClientNoCodec(Configuration conf) { return new BlockingRpcClient(conf) { @Override Codec getCodec() { return null; } }; }
try { this.socket = this.rpcClient.socketFactory.createSocket(); this.socket.setTcpNoDelay(this.rpcClient.isTcpNoDelay()); this.socket.setKeepAlive(this.rpcClient.tcpKeepAlive); if (this.rpcClient.localAddr != null) {
@Override protected BlockingRpcClient createRpcClient(Configuration conf) { return new BlockingRpcClient(conf); }
@Ignore @Test public void testRpcScheduler() throws IOException, InterruptedException { PriorityFunction qosFunction = mock(PriorityFunction.class); Abortable abortable = new AbortServer(); CONF.set(RpcServerFactory.CUSTOM_RPC_SERVER_IMPL_CONF_KEY, rpcServerImpl); RpcScheduler scheduler = new SimpleRpcScheduler(CONF, 2, 0, 0, 0, qosFunction, abortable, 0); RpcServer rpcServer = RpcServerFactory.createRpcServer(null, "testRpcServer", Lists.newArrayList(new BlockingServiceAndInterface((BlockingService) SERVICE, null)), new InetSocketAddress("localhost", 0), CONF, scheduler); try (BlockingRpcClient client = new BlockingRpcClient(CONF)) { rpcServer.start(); BlockingInterface stub = newBlockingStub(client, rpcServer.getListenerAddress()); stub.echo(null, EchoRequestProto.newBuilder().setMessage("hello").build()); } catch (Throwable e) { assert (abortable.isAborted() == true); } finally { rpcServer.stop(); } }
@Override protected BlockingRpcClient createRpcClientNoCodec(Configuration conf) { return new BlockingRpcClient(conf) { @Override Codec getCodec() { return null; } }; }
@Override protected BlockingRpcClient createRpcClientRTEDuringConnectionSetup(Configuration conf) throws IOException { return new BlockingRpcClient(conf) { @Override boolean isTcpNoDelay() { throw new RuntimeException("Injected fault"); } }; }
protected AbstractRpcClient<?> createRpcClient(Configuration conf, boolean isSyncClient) { return isSyncClient ? new BlockingRpcClient(conf) : new NettyRpcClient(conf) { @Override Codec getCodec() { return null; } }; }
@Override protected BlockingRpcClient createRpcClient(Configuration conf) { return new BlockingRpcClient(conf); }
@Ignore @Test public void testRpcScheduler() throws IOException, InterruptedException { PriorityFunction qosFunction = mock(PriorityFunction.class); Abortable abortable = new AbortServer(); CONF.set(RpcServerFactory.CUSTOM_RPC_SERVER_IMPL_CONF_KEY, rpcServerImpl); RpcScheduler scheduler = new SimpleRpcScheduler(CONF, 2, 0, 0, qosFunction, abortable, 0); RpcServer rpcServer = RpcServerFactory.createRpcServer(null, "testRpcServer", Lists.newArrayList(new BlockingServiceAndInterface((BlockingService) SERVICE, null)), new InetSocketAddress("localhost", 0), CONF, scheduler); try (BlockingRpcClient client = new BlockingRpcClient(CONF)) { rpcServer.start(); BlockingInterface stub = newBlockingStub(client, rpcServer.getListenerAddress()); stub.echo(null, EchoRequestProto.newBuilder().setMessage("hello").build()); } catch (Throwable e) { assert (abortable.isAborted() == true); } finally { rpcServer.stop(); } }