Package org.xsocket.connection

Examples of org.xsocket.connection.NonBlockingConnection


      SSLContext sslContext = SSLTestContextFactory.getSSLContext();
     
        IServer server = new HttpServer(0, new ContentEchoHandler(), sslContext, true);
        server.start();

        INonBlockingConnection tcpCon = new NonBlockingConnection("localhost", server.getLocalPort(), sslContext, true);
        HttpClientConnection con = new HttpClientConnection(tcpCon);
   
           
        FutureResponseHandler hdl = new FutureResponseHandler();
       
View Full Code Here


    @Test
    public void testIdleTimeout() throws Exception {

        IServer server = new HttpServer(new DoNothingRequestHandler());
       
        INonBlockingConnection con = new NonBlockingConnection("localhost", server.getLocalPort());
        con.setIdleTimeoutMillis(1000);
       
        HttpClientConnection httpCon = new HttpClientConnection(con);
       
        ResponseHandler respHdl = new ResponseHandler();
        httpCon.send(new GetRequest("/"), respHdl);
View Full Code Here

    @Test
    public void testIdleTimeoutHandler() throws Exception {

        IServer server = new HttpServer(new DoNothingRequestHandler());
       
        INonBlockingConnection con = new NonBlockingConnection("localhost", server.getLocalPort());
        con.setIdleTimeoutMillis(1000);
       
        HttpClientConnection httpCon = new HttpClientConnection(con);
       
        ResponseHandler2 respHdl = new ResponseHandler2();
        httpCon.send(new GetRequest("/"), respHdl);
View Full Code Here

     * @param targetHost       the target host
     * @param targetPort       the target port
     * @throws IOException if an exception occurs
     */
    public static void establishTcpTunnel(IHttpConnection httpConnection, String targetHost, int targetPort) throws IOException {
        INonBlockingConnection forwardCon = new NonBlockingConnection(targetHost, targetPort);
       
        INonBlockingConnection tcpCon = httpConnection.getUnderlyingTcpConnection();

        forwardCon.setAttachment(tcpCon);
        tcpCon.setAttachment(forwardCon);
           
        forwardCon.setFlushmode(FlushMode.ASYNC);
        forwardCon.setAutoflush(false);
        tcpCon.setFlushmode(FlushMode.ASYNC);
        tcpCon.setAutoflush(false);

        forwardCon.setHandler(new TcpProxyHandler());
        tcpCon.setHandler(new TcpProxyHandler());
    }
View Full Code Here

     * @param targetHost       the target host
     * @param targetPort       the target port
     * @throws IOException if an exception occurs
     */
    public static void establishTcpTunnel(IHttpConnection httpConnection, String targetHost, int targetPort) throws IOException {
        INonBlockingConnection forwardCon = new NonBlockingConnection(targetHost, targetPort);
       
        INonBlockingConnection tcpCon = httpConnection.getUnderlyingTcpConnection();

        forwardCon.setAttachment(tcpCon);
        tcpCon.setAttachment(forwardCon);
           
        forwardCon.setFlushmode(FlushMode.ASYNC);
        forwardCon.setAutoflush(false);
        tcpCon.setFlushmode(FlushMode.ASYNC);
        tcpCon.setAutoflush(false);

        forwardCon.setHandler(new TcpProxyHandler());
        tcpCon.setHandler(new TcpProxyHandler());
    }
View Full Code Here


  private static INonBlockingConnection newNonBlockingConnection(InetSocketAddress address, Executor workerpool) throws ConnectException {
    try {
        if (workerpool == null) {
            return new NonBlockingConnection(address);
        } else {
            return new NonBlockingConnection(address.getHostName(), address.getPort(), null, workerpool);
        }
    } catch (IOException ioe) {
      throw new ConnectException(ioe.toString());
    }
  }
View Full Code Here

TOP

Related Classes of org.xsocket.connection.NonBlockingConnection

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.