Examples of SocketListener


Examples of org.browsermob.proxy.jetty.http.SocketListener

        //create a stream manager that will be capped to 100 Megabits
        //remember that by default it is disabled!
        streamManager = new StreamManager( 100 * BandwidthLimiter.OneMbps );

        server = new Server();
        HttpListener listener = new SocketListener(new InetAddrPort(getPort()));
        server.addListener(listener);
        HttpContext context = new HttpContext();
        context.setContextPath("/");
        server.addContext(context);

        handler = new BrowserMobProxyHandler();
        handler.setJettyServer(server);
        handler.setShutdownLock(new Object());
        client = new BrowserMobHttpClient(streamManager, requestCounter);
        client.prepareForBrowser();
        handler.setHttpClient(client);

        context.addHandler(handler);

        server.start();

        setPort(listener.getPort());
    }
View Full Code Here

Examples of org.mortbay.http.SocketListener

                JettySslListenerConfigurer secureListenerConfigurer =
                    new JettySslListenerConfigurer(config, sslPolicy, secureListener);
                secureListenerConfigurer.configure();

            } else {
                listener = new SocketListener(new InetAddrPort(port));
            }
           
            if (policy.isSetMinThreads()) {
                listener.setMinThreads(policy.getMinThreads());
            }
View Full Code Here

Examples of org.mortbay.http.SocketListener

       
        assertNotNull(endpoint);
        assertTrue(!endpoint.isPublished());
       
        HttpServer server = new HttpServer();     
        SocketListener listener = new SocketListener(new InetAddrPort(27220));
        server.addListener(listener);
        try {
            server.start();
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
       
        HttpContext context = server.getContext("http://localhost:27220/test");
        endpoint.publish(context);
        assertTrue(endpoint.isPublished());
       
        listener.stop();
        server.stop(true);
       
       
    }
View Full Code Here

Examples of org.mortbay.http.SocketListener

        actualPort = defaultPort == -1 ? 28080 : defaultPort;
        serverLock.start(actualPort);

        server = createServer();

        SocketListener socketListener = new SocketListener();
        socketListener.setPort(actualPort);
        socketListener.setMinThreads(10);
        socketListener.setMaxThreads(200);
        socketListener.setMaxIdleTimeMs(0);
        socketListener.setLowResourcePersistTimeMs(2000);
        socketListener.setAcceptQueueSize(0);
        socketListener.setPoolName("P1");
        server.addListener(socketListener);

        // // Add the context
        // HttpContext context = new CustomHttpContext(server, "/",
        // useDevConfig);
View Full Code Here

Examples of org.mortbay.http.SocketListener

            log.warn("Not setting trust managers there are no SSL listeners configured.");
        } else {
            if (log.isInfoEnabled())
                log.info("Set trust managers");
            for (Iterator i = listeners.iterator(); i.hasNext();) {
                SocketListener l = (SocketListener) i.next();
                if (l instanceof CustomJsseListener) {
                    ((CustomJsseListener) l).setNeedClientAuth(trustManager != null);
                    ((CustomJsseListener) l).setTrustManager(trustManager, require);
                }
            }
View Full Code Here

Examples of org.mortbay.http.SocketListener

        insecureServer = new Server();
        for (Iterator<String> i = l.iterator(); i.hasNext();) {
            String address = i.next();
            if (log.isInfoEnabled())
                log.info("Adding listener on " + address + ":" + port);
            SocketListener listener = new SocketListener();
            listener.setHost(address);
            listener.setPort(port);
            listener.setMinThreads(contextConfiguration.retrievePropertyInt(new ContextKey("webServer.minThreads")));
            listener.setMaxThreads(contextConfiguration.retrievePropertyInt(new ContextKey("webServer.maxThreads")));
            listener.setMaxIdleTimeMs(0);
            listener.setLowResourcePersistTimeMs(2000);
            listener.setAcceptQueueSize(0);
            listener.setPoolName("P2");
            insecureServer.addListener(listener);
        }
       
        // Create the webapp
        HttpContext context = new HttpContext();
View Full Code Here

Examples of org.mortbay.http.SocketListener

            if (log.isInfoEnabled())
                log.info("Adding listener on " + address + ":" + actualPort);
            if (!serverLock.isStarted()) {
                serverLock.start(actualPort);
            }
            SocketListener listener = null;
            if (contextConfiguration.retrieveProperty(new ContextKey("webServer.protocol")).equals("http")) {
                listener = new SocketListener();
                log.warn("The server is configured to listen for plain HTTP connections.");
            } else {
                listener = new CustomJsseListener(keystorePassword);
                MsieSslHandler sslHandler = new MsieSslHandler();
                sslHandler.setUserAgentSubString("MSIE 5");
                listener.setHttpHandler(sslHandler);
            }
            listener.setPort(actualPort);
            listener.setMinThreads(contextConfiguration.retrievePropertyInt(new ContextKey("webServer.minThreads")));
            listener.setMaxThreads(contextConfiguration.retrievePropertyInt(new ContextKey("webServer.maxThreads")));
            listener.setMaxIdleTimeMs(contextConfiguration.retrievePropertyInt(new ContextKey("webServer.maxIdleTimeMs")));
            listener.setHost(address);
            listener.setBufferSize(contextConfiguration.retrievePropertyInt(new ContextKey("webServer.bufferSize")));
            listener.setBufferReserve(contextConfiguration.retrievePropertyInt(new ContextKey("webServer.bufferReserve")));
            listener.setTcpNoDelay(contextConfiguration.retrievePropertyBoolean(new ContextKey("webServer.tcpNoDelay")));
            listener.setThreadsPriority(contextConfiguration.retrievePropertyInt(new ContextKey("webServer.threadPriority")));
            listeners.add(listener);

            listener.setLowResourcePersistTimeMs(contextConfiguration.retrievePropertyInt(new ContextKey(
                            "webServer.lowResourcePersistTimeMs")));
            listener.setPoolName("main");
            server.addListener(listener);
        }
       
        // Add the context
        getBootProgressMonitor().updateMessage("Creating web application");
View Full Code Here

Examples of org.mortbay.http.SocketListener

/**
* @version $Rev: 278800 $ $Date: 2005-09-05 11:10:49 -0600 (Mon, 05 Sep 2005) $
*/
public class HTTPConnector extends JettyConnector {
    public HTTPConnector(JettyContainer container) {
        super(container, new SocketListener());
    }
View Full Code Here

Examples of org.mortbay.http.SocketListener

        return listener.getBufferSize();
    }

    public void setBufferSizeBytes(int bytes) {
        if(listener instanceof SocketListener) {
            SocketListener socketListener = (SocketListener)listener;
            socketListener.setBufferSize(bytes);
        } else if(listener instanceof AJP13Listener) {
            ((AJP13Listener)listener).setBufferSize(bytes);
        } else {
            throw new UnsupportedOperationException(listener == null ? "No Listener" : listener.getClass().getName()); //todo: can this happen?
        }
View Full Code Here

Examples of org.mortbay.http.SocketListener

        return listener.getConfidentialPort();
    }

    public void setRedirectPort(int port) {
        if(listener instanceof SocketListener) {
            SocketListener socketListener = (SocketListener)listener;
            socketListener.setConfidentialPort(port);
            socketListener.setIntegralPort(port);
            socketListener.setIntegralScheme("https");
            socketListener.setConfidentialScheme("https");
        } else if(listener instanceof AJP13Listener) {
            AJP13Listener ajpListener = (AJP13Listener) listener;
            ajpListener.setConfidentialPort(port);
            ajpListener.setIntegralPort(port);
            ajpListener.setIntegralScheme("https");
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.