@Override public void handle(final PhysicalConnection connection, int rpcType, ByteString pBody, ByteBuf dBody, ResponseSender sender) throws RpcException { switch(rpcType){ case 1: sender.send(new Response(new FakeEnum(1), expectedD)); new Thread(){ @Override public void run() { try { closeLatch.await(); ((RemoteConnection)connection).getChannel().close(); } catch (InterruptedException e) { } } }.start(); return; case 2: ((RemoteConnection)connection).getChannel().close(); return; default: throw new UnsupportedOperationException(); } }
@Override public void doRpcCall(RpcOutcomeListener<NodeEndpoint> outcomeListener, ProxyConnection connection) { connection.send(outcomeListener, new FakeEnum(type), expectedQ, NodeEndpoint.class); }