@Override
    public Message callBlockingMethod(MethodDescriptor md, RpcController controller, Message param,
      Message returnType) throws ServiceException {
      invokations.getAndIncrement();
      if (ThreadLocalRandom.current().nextFloat() < CHANCE_OF_TIMEOUT) {
        // throw a ServiceException, becuase that is the only exception type that
        // {@link ProtobufRpcEngine} throws. If this RpcEngine is used with a different
        // "actual" type, this may not properly mimic the underlying RpcEngine.
        throw new ServiceException(new SocketTimeoutException("fake timeout"));
      }
      return super.callBlockingMethod(md, controller, param, returnType);
    }
Blocking rpc channel that goes via hbase rpc.
hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestClientTimeouts.java