Package com.linkedin.r2.transport.common.bridge.client

Examples of com.linkedin.r2.transport.common.bridge.client.TransportClient


  @Override
  public TransportClient getClient(String serviceName, String scheme)
  {
    Map<String, TransportClient> transportClients = _serviceClients.get(serviceName);
    TransportClient transportClient = null;

    if (transportClients != null)
    {
      transportClient = transportClients.get(scheme.toLowerCase());
      if (transportClient == null)
View Full Code Here


    {
      _log.error("getTrackerClient: unknown service name {} for URI {} and partitionDataMap {}",
          new Object[]{ serviceName, uri, partitionDataMap });
      return null;
    }
    TransportClient client = clientsByScheme.get(uri.getScheme().toLowerCase());
    if (client == null)
    {
      _log.error("getTrackerClient: invalid scheme for service {}, URI {} and partitionDataMap {}",
          new Object[]{ serviceName, uri, partitionDataMap });
      return null;
View Full Code Here

        }

        if (factory != null)
        {
          transportClientProperties.put(HttpClientFactory.HTTP_SERVICE_NAME, serviceProperties.getServiceName());
          TransportClient client = factory.getClient(transportClientProperties);
          newTransportClients.put(scheme.toLowerCase(), client);
        }
        else
        {
          _log.warn("Failed to find client factory for scheme {}", scheme);
View Full Code Here

  }

  @Test
  public void testClient() throws Exception
  {
    final TransportClient transportClient = _clientFactory.getClient(new HashMap<String, String>());
    final Client client = new TransportClientAdapter(transportClient);

    RestRequestBuilder rb = new RestRequestBuilder(_testServer.getRequestURI());
    rb.setMethod("GET");
    RestRequest request = rb.build();
View Full Code Here

  @Test
  public void testRequestContextReuse() throws Exception
  {
    final Integer REQUEST_TIMEOUT = 1000;
    final TransportClient transportClient =
        _clientFactory.getClient(Collections.singletonMap(HttpClientFactory.HTTP_REQUEST_TIMEOUT,
                                                          Integer.toString(REQUEST_TIMEOUT)));
    final Client client = new TransportClientAdapter(transportClient);

    RestRequestBuilder rb = new RestRequestBuilder(_testServer.getRequestURI());
View Full Code Here

    final int WARM_UP = 10;
    final int N = 5;
    final int REQUEST_TIMEOUT = 1000;

    // Specify the get timeout; we know the max rate will be half the get timeout
    final TransportClient transportClient =
        new HttpClientFactory().getClient(Collections.singletonMap(HttpClientFactory.HTTP_REQUEST_TIMEOUT,
                                                                   Integer.toString(REQUEST_TIMEOUT)));
    final Client client = new TransportClientAdapter(transportClient);

    final ServerSocket ss = new ServerSocket();
View Full Code Here

  }

  @Test
  public void testSimpleURI() throws Exception
  {
    final TransportClient transportClient = _clientFactory.getClient(new HashMap<String, String>());
    final Client client = new TransportClientAdapter(transportClient);

    // Note no trailing slash; the point of the test is to ensure this URI will
    // send a Request-URI of "/".
    URI uri = URI.create("http://localhost:" + _testServer.getPort());
View Full Code Here

                   int zoneId) {
        super(storeName);
        if(transportClient == null) {
            this.client = d2Client;
        } else {
            this.client = new TransportClientAdapter(transportClient);
        }
        this.config = config;
        this.restBootstrapURL = restBootstrapURL;
        this.mapper = new ObjectMapper();
        this.routingTypeCode = routingCodeStr;
View Full Code Here

        this.config = config;
        this.httpClientFactory = new HttpClientFactory();
        Map<String, String> properties = Maps.newHashMap();
        properties.put(HttpClientFactory.HTTP_POOL_SIZE,
                       Integer.toString(this.config.getMaxR2ConnectionPoolSize()));
        this.client = new TransportClientAdapter(httpClientFactory.getClient(properties));
    }
View Full Code Here

    int index = entries * 4 - 1;
    for (String operation: compressionOperations)
    {
      Map<String, String> clientProperties = new HashMap<String, String>();
      clientProperties.put(HttpClientFactory.HTTP_RESPONSE_COMPRESSION_OPERATIONS, operation);
      TransportClientAdapter clientAdapter = new TransportClientAdapter(new HttpClientFactory(FilterChains.empty()).getClient(clientProperties));
      RestClient client = new RestClient(clientAdapter, URI_PREFIX);
      result[index--] = new Object[]{ client, operation, RestliRequestOptions.DEFAULT_OPTIONS, Arrays.asList(1000L, 2000L), 0 };
      result[index--] = new Object[]{ client, operation, TestConstants.FORCE_USE_NEXT_OPTIONS, Arrays.asList(1000L, 2000L), 0 };
      result[index--] = new Object[]{ client, operation, RestliRequestOptions.DEFAULT_OPTIONS, Arrays.asList(1L, 2L, 3L, 4L), 4 };
      result[index--] = new Object[]{ client, operation, TestConstants.FORCE_USE_NEXT_OPTIONS, Arrays.asList(1L, 2L, 3L, 4L), 4 };
View Full Code Here

TOP

Related Classes of com.linkedin.r2.transport.common.bridge.client.TransportClient

Copyright © 2018 www.massapicom. 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.