Examples of NetClient


Examples of io.vertx.core.net.NetClient

    assertTrue(server.metrics().isEmpty());
  }

  @Test
  public void testDummyNetClientMetrics() {
    NetClient client = vertx.createNetClient(new NetClientOptions());
    assertNull(client.metricBaseName());
    assertTrue(client.metrics().isEmpty());
  }
View Full Code Here

Examples of net.tacospice.stevenet.NetClient

  protected final GameEventHandler eventHandler;
  protected final Game game;

  public GameClient(Game game, GameEventHandler handler)
  {
    client = new NetClient();
    client.setEventHandler(this);
    client.setUpdateRate(20);

    eventHandler = handler;
View Full Code Here

Examples of org.vertx.java.core.net.NetClient

        this.serviceLoadBalancer = serviceLoadBalancer;
    }

    @Override
    public void handle(final NetSocket socket) {
        NetClient client = null;
        List<String> paths = serviceMap.getPaths();
        TcpClientRequestFacade requestFacade = new TcpClientRequestFacade(socket);
        String path = pathLoadBalancer.choose(paths, requestFacade);
        if (path != null) {
            List<ServiceDetails> services = serviceMap.getServices(path);
View Full Code Here

Examples of org.vertx.java.core.net.NetClient

    /**
     * Creates a new client for the given URL and handler
     */
    protected NetClient createClient(NetSocket socket, URI url, Handler<AsyncResult<NetSocket>> handler) throws MalformedURLException {
        NetClient client = vertx.createNetClient();
        int port = url.getPort();
        String host = url.getHost();
        LOG.info("Connecting " + socket.remoteAddress() + " to host " + host + " port " + port + " protocol " + protocol);
        return client.connect(port, host, handler);
    }
View Full Code Here

Examples of org.vertx.java.core.net.NetClient

            shutdownTacker.release();
        }
    }

    public void route(final SocketWrapper socket, ConnectionParameters params, final Buffer received) {
        NetClient client = null;

        if( params.protocolVirtualHost==null ) {
            params.protocolVirtualHost = defaultVirtualHost;
        }
        HashSet<String> schemes = new HashSet<String>(Arrays.asList(params.protocolSchemes));
View Full Code Here

Examples of org.vertx.java.core.net.NetClient

    /**
     * Creates a new client for the given URL and handler
     */
    private NetClient createClient(final ConnectionParameters params, final SocketWrapper socketFromClient, final URI url, final Buffer received) {
        NetClient netClient = vertx.createNetClient();
        return netClient.connect(url.getPort(), url.getHost(), new Handler<AsyncResult<NetSocket>>() {
            public void handle(final AsyncResult<NetSocket> asyncSocket) {

                if( !asyncSocket.succeeded() ) {
                    handleConnectFailure(socketFromClient, String.format("Could not connect to '%s'", url));
                } else {
View Full Code Here

Examples of org.vertx.java.core.net.NetClient

    // Once we connect we send them.
    // This can also be invoked concurrently from different threads, so it gets a little
    // tricky
    ConnectionHolder holder = connections.get(theServerID);
    if (holder == null) {
      NetClient client = vertx.createNetClient();
      // When process is creating a lot of connections this can take some time
      // so increase the timeout
      client.setConnectTimeout(60 * 1000);
      holder = new ConnectionHolder(client);
      ConnectionHolder prevHolder = connections.putIfAbsent(theServerID, holder);
      if (prevHolder != null) {
        // Another one sneaked in
        holder = prevHolder;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.