Package org.xsocket.connection

Examples of org.xsocket.connection.NonBlockingConnectionPool


      };
     
      IServer server = new Server(dh);
      server.start();
     
      NonBlockingConnectionPool pool = new NonBlockingConnectionPool();
             
        for (int i = 0; i < 1000; i++) {
            HttpClientConnection httpCon = new HttpClientConnection(pool.getNonBlockingConnection("localhost", server.getLocalPort()));
            IHttpResponse resp = httpCon.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
       
            InputStream in = Channels.newInputStream(resp.getBody());
            in.close();
               
            httpCon.close();
        }
       
        pool.close();
  }
View Full Code Here


 
  @Test
  public void testLive() throws Exception {
   
    NonBlockingConnectionPool pool = new NonBlockingConnectionPool();
   
    for (int i = 0; i < 10; i++) {
      ConnectHandler ch = new ConnectHandler();
     
      long start = System.nanoTime();
     
      INonBlockingConnection nbc = pool.getNonBlockingConnection("www.gmx.com", 80, ch);
      // perform ch.isConnected() later. It will be called multithreaded
     
      HttpClientConnection con = new HttpClientConnection(nbc);
     
      IHttpRequest request = new GetRequest("http://www.gmx.com/doesNotExist.html");
View Full Code Here

   * @param interceptors  the interceptors
   */
  public HttpClient(SSLContext sslCtx, IHttpRequestHandler... interceptors) {
     
     
      pool = new NonBlockingConnectionPool(sslCtx);
      pool.setPooledMaxIdleTimeMillis(DEFAULT_PERSISTENT_CONNECTION_TIMEOUT);
     
    setPooledMaxIdleTimeMillis(DEFAULT_POOLED_IDLE_TIMEOUT_MILLIS);
    setPooledMaxLifeTimeMillis(DEFAULT_POOLED_LIFE_TIMEOUT_MILLIS);
   
View Full Code Here

                  LOG.fine("default SSLContext -> SSLContext.getDefault() is loaded automatically");
              }
          } catch (Exception ignore) { }
      }
     
    pool = new NonBlockingConnectionPool(sslContext);
    pool.setPooledMaxIdleTimeMillis(DEFAULT_PERSISTENT_CONNECTION_TIMEOUT);
  }
View Full Code Here

TOP

Related Classes of org.xsocket.connection.NonBlockingConnectionPool

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.