HttpProvider should be used to send rpc calls over http
328503
function HttpProvider(host, timeout) {
  if (!(this instanceof HttpProvider)) { throw new Error('[ethjs-provider-http] the HttpProvider instance requires the "new" flag in order to function normally (e.g. `const eth = new Eth(new HttpProvider());`).'); }
  if (typeof host !== 'string') { throw new Error('[ethjs-provider-http] the HttpProvider instance requires that the host be specified (e.g. `new HttpProvider("http://localhost:8545")` or via service like infura `new HttpProvider("http://ropsten.infura.io")`)'); }

  const self = this;
  self.host = host;
  self.timeout = timeout || 0;
}
765107
public void run() throws Exception {
    if (config == null) {
      return;
    }

    SimpleRequest req = newRequest();

    InetSocketAddress socketAddress = (InetSocketAddress) config.address;

    if (!config.tls)
      system.log().info("Using plaintext gRPC HTTP/2 connections");

    GrpcClientSettings settings = Utils.createGrpcClientSettings(socketAddress, config.tls, system);

    List<BenchmarkServiceClient> clients = new ArrayList<BenchmarkServiceClient>(config.channels);
    for (int i = 0; i < config.channels; i++) {
      BenchmarkServiceClient client = BenchmarkServiceClient.create(settings, mat, system.dispatcher());
      clients.add(client);
    }

    // Do a warmup first. It's the same as the actual benchmark, except that
    // we ignore the statistics.
    warmup(req, clients);

    long startTime = System.nanoTime();
    long endTime = startTime + TimeUnit.SECONDS.toNanos(config.duration);
    List<Histogram> histograms = doBenchmark(req, clients, endTime);
    long elapsedTime = System.nanoTime() - startTime;

    Histogram merged = merge(histograms);

    printStats(merged, elapsedTime);
    if (config.histogramFile != null) {
      saveHistogram(merged, config.histogramFile);
    }
    shutdown(clients);
  }
900581
private <T> T executeHttpCallWithRetry(HttpCall<T> call, int runCount) {
    try {
      return call.execute();
    }
    catch (PackageManagerHttpActionException ex) {
      // retry again if configured so...
      if (runCount < props.getRetryCount()) {
        log.info("ERROR: " + ex.getMessage());
        log.debug("HTTP call failed.", ex);
        log.info("---------------");

        StringBuilder msg = new StringBuilder();
        msg.append("HTTP call failed, try again (" + (runCount + 1) + "/" + props.getRetryCount() + ")");
        if (props.getRetryDelaySec() > 0) {
          msg.append(" after " + props.getRetryDelaySec() + " second(s)");
        }
        msg.append("...");
        log.info(msg);
        if (props.getRetryDelaySec() > 0) {
          try {
            Thread.sleep(props.getRetryDelaySec() * DateUtils.MILLIS_PER_SECOND);
          }
          catch (InterruptedException ex1) {
            // ignore
          }
        }
        return executeHttpCallWithRetry(call, runCount + 1);
      }
      else {
        throw ex;
      }
    }
  }
540197
function send(httpMethod, path, req) {
    req = req || {};
    httpMethod = httpMethod.toUpperCase();

    var deferred = Q.defer();
    var url = baseUrl + path;
    var data = req.data || {};          // separate out data from request
    delete req.data;

    var isAdmin = req.caller && req.caller.role === 'admin';
    delete req.caller;

    var id = req._id || data._id;       // get id from request or data
    if (req._id) { delete req._id; }    // delete id from request so no dupe

    var session = cls.getNamespace('appSession');
    var caller = session && session.active && session.get('caller');
    if (caller && !isAdmin) {
        _.extend(req, {                 // onBehalfOf used by API to know who is the caller
            onBehalfOfType: caller.type,
            onBehalfOfId:   caller._id + '',
            onBehalfOfRole: caller.role,
            onBehalfOfName: caller.name
        });
    }

    _.each(req, function (val, key) {
        if (!_.isString(val)) { req[key] = JSON.stringify(val); }
    });

    // replace the ID portion of the URL
    url = id ?
        url.replace('{_id}', id + '') :
        url.replace('/{_id}', '');

    var reqConfig = {
        headers:    headers,
        url:        url,
        method:     httpMethod,
        qs:         _.isEmpty(req) ? undefined : req,
        json:       _.isEmpty(data) ? true : data
    };

    // if baseUrl not there yet, wait for 100 seconds until it is (i.e. during system startup)
    if (!baseUrl) {
        setTimeout(function () {
            makeRequest(reqConfig, deferred);
        }, 100);
    }
    else {
        makeRequest(reqConfig, deferred);
    }

    return deferred.promise;
}
87969
public long sendRpc(ByteBuffer message, RpcResponseCallback callback) {
    if (logger.isTraceEnabled()) {
      logger.trace("Sending RPC to {}", getRemoteAddress(channel));
    }

    long requestId = requestId();
    handler.addRpcRequest(requestId, callback);

    RpcChannelListener listener = new RpcChannelListener(requestId, callback);
    channel.writeAndFlush(new RpcRequest(requestId, new NioManagedBuffer(message)))
      .addListener(listener);

    return requestId;
  }
85523
def _send_rpc(self, device_info, control_info, address, rpc_id, payload, poll_interval, timeout):
        """"""

        write_address, write_data = control_info.format_rpc(address, rpc_id, payload)
        self._jlink.memory_write32(write_address, write_data)

        self._trigger_rpc(device_info)

        start = monotonic()
        now = start

        poll_address, poll_mask = control_info.poll_info()

        while (now - start) < timeout:
            time.sleep(poll_interval)
            value, = self._jlink.memory_read8(poll_address, 1)

            if value & poll_mask:
                break

            now = monotonic()

        if (now - start) >= timeout:
            raise HardwareError("Timeout waiting for RPC response", timeout=timeout, poll_interval=poll_interval)

        read_address, read_length = control_info.response_info()
        read_data = self._read_memory(read_address, read_length, join=True)

        return control_info.format_response(read_data)
267995
async def send_rpc(self, conn_id, address, rpc_id, payload, timeout):
        

        adapter_id = self._get_property(conn_id, 'adapter')
        return await self.adapters[adapter_id].send_rpc(conn_id, address, rpc_id, payload, timeout)
748255
public static RequestResponse callHttpPost(HttpJsonRpcClient client, String url,
            Map<String, Object> headers, Map<String, Object> urlParams, Object requestData) {
        return client.doPost(url, headers, urlParams, requestData);
    }
510972
function TcpClientData (buffer) {
    this.controller.Debug(7, "[%s] Data=[%s]", this.uid, buffer);
    // call adapter specific routine to process messages
    var status = this.adapter.ParseBuffer(this, buffer);
   
}
676812
public static RequestResponse callHttpPatch(HttpJsonRpcClient client, String url,
            Map<String, Object> headers, Map<String, Object> urlParams, Object requestData) {
        return client.doPatch(url, headers, urlParams, requestData);
    }
1076201
public final HttpServer protocol(HttpProtocol... supportedProtocols) {
		return tcpConfiguration(tcpServer -> tcpServer.bootstrap(b -> HttpServerConfiguration.protocols(b, supportedProtocols)));
	}
541343
function RPCClient(options) {
  if (!(this instanceof RPCClient))
    return new RPCClient(options);

  if (!options)
    options = {};

  if (typeof options === 'string')
    options = { uri: options };

  this.options = options;
  this.network = Network.get(options.network);

  this.uri = options.uri || `http://localhost:${this.network.rpcPort}`;
  this.apiKey = options.apiKey;
  this.id = 0;
}
267860
static <WReqT, WRespT> ClientInterceptor wrapClientInterceptor(
      final ClientInterceptor interceptor,
      final Marshaller<WReqT> reqMarshaller,
      final Marshaller<WRespT> respMarshaller) {
    return new ClientInterceptor() {
      @Override
      public <ReqT, RespT> ClientCall<ReqT, RespT> interceptCall(
          final MethodDescriptor<ReqT, RespT> method, CallOptions callOptions, Channel next) {
        final MethodDescriptor<WReqT, WRespT> wrappedMethod =
            method.toBuilder(reqMarshaller, respMarshaller).build();
        final ClientCall<WReqT, WRespT> wrappedCall =
            interceptor.interceptCall(wrappedMethod, callOptions, next);
        return new PartialForwardingClientCall<ReqT, RespT>() {
          @Override
          public void start(final Listener<RespT> responseListener, Metadata headers) {
            wrappedCall.start(new PartialForwardingClientCallListener<WRespT>() {
              @Override
              public void onMessage(WRespT wMessage) {
                InputStream bytes = respMarshaller.stream(wMessage);
                RespT message = method.getResponseMarshaller().parse(bytes);
                responseListener.onMessage(message);
              }

              @Override
              protected Listener<?> delegate() {
                return responseListener;
              }
            }, headers);
          }

          @Override
          public void sendMessage(ReqT message) {
            InputStream bytes = method.getRequestMarshaller().stream(message);
            WReqT wReq = reqMarshaller.parse(bytes);
            wrappedCall.sendMessage(wReq);
          }

          @Override
          protected ClientCall<?, ?> delegate() {
            return wrappedCall;
          }
        };
      }
    };
  }
500097
private Connection getConnection(InetSocketAddress addr,
                                   Class<?> protocol,
                                   UserGroupInformation ticket,
                                   int rpcTimeout,
                                   Call call)
                                   throws IOException {
    if (!running.get()) {
      // the client is stopped
      throw new IOException("The client is stopped");
    }
    Connection connection;
    /* we could avoid this allocation for each RPC by having a  
     * connectionsId object and with set() method. We need to manage the
     * refs for keys in HashMap properly. For now its ok.
     */
    ConnectionId remoteId = new ConnectionId(
		addr, protocol, ticket, rpcTimeout);
    do {
      synchronized (connections) {
        connection = connections.get(remoteId);
        if (connection == null) {
          connection = new Connection(remoteId);
          connections.put(remoteId, connection);
        }
      }
    } while (!connection.addCall(call));
    
    //we don't invoke the method below inside "synchronized (connections)"
    //block above. The reason for that is if the server happens to be slow,
    //it will take longer to establish a connection and that will slow the
    //entire system down.
    boolean success = false;
    try {
      connection.setupIOstreams();
      success = true;
    } finally {
      if (!success) {
        // We need to make sure connection is removed from connections object if
        // there is any unhandled exception (like OOM). In this case, unlikely
        // there is response thread started which can clear the connection
        // eventually.
        try {
          if (connection.closeException == null) {
            connection.markClosed(new IOException(
                "Unexpected error when setup IO Stream"));
          }
        } finally {
          connection.close(true);
        }
      }
    }
    return connection;
  }
167100
public void sendRequest(String host, int port, int timeout, String func, String funcArg)
    {
        DRPCClient client = null;

        try
        {
            client = createClient(host, port, timeout);
        }
        catch (Exception ex)
        {
            logger.error("DRPCClient connect failed.", ex);
            return;
        }

        String result = null;

        try
        {
            result = client.execute(func, funcArg);
            logger.info("DRPCRequest result is " + result);
        }
        catch (Exception ex)
        {
            logger.error("DRPCRequest failed.", ex);
        }
        finally
        {
            client.close();
        }
    }
846958
private Observable<HttpClientResponse<O>> submitToServerInURI(
            HttpClientRequest<I> request, IClientConfig requestConfig, ClientConfig config,
            RetryHandler errorHandler, ExecutionContext<HttpClientRequest<I>> context)  {
        // First, determine server from the URI
        URI uri;
        try {
            uri = new URI(request.getUri());
        } catch (URISyntaxException e) {
            return Observable.error(e);
        }
        String host = uri.getHost();
        if (host == null) {
            return null;
        }
        int port = uri.getPort();
        if (port < 0) {
            if (Optional.ofNullable(clientConfig.get(IClientConfigKey.Keys.IsSecure)).orElse(false)) {
                port = 443;
            } else {
                port = 80;
            }
        }
        
        return LoadBalancerCommand.<HttpClientResponse<O>>builder()
                .withRetryHandler(errorHandler)
                .withLoadBalancerContext(lbContext)
                .withListeners(listeners)
                .withExecutionContext(context)
                .withServer(new Server(host, port))
                .build()
                .submit(this.requestToOperation(request, getRxClientConfig(requestConfig, config)));
    }
1135951
def handle_request(self, request, **resources):
        

        if request.method == 'OPTIONS':
            return super(RPCResource, self).handle_request(
                request, **resources)

        payload = request.data

        try:

            if request.method == 'GET':
                payload = request.GET.get('payload')
                try:
                    payload = js.loads(payload)
                except TypeError:
                    raise AssertionError("Invalid RPC Call.")

            if 'method' not in payload:
                raise AssertionError("Invalid RPC Call.")
            return self.rpc_call(request, **payload)

        except Exception as e: # noqa (any error)
            return SerializedHttpResponse(dict(error=dict(message=str(e))), error=True)