/** * This creates a new background task that will listen to the * specified <code>ServerAddress</code> for incoming TCP connect * requests. When an connection is accepted it is handed to the * internal socket connector. * * @param address this is the address used to accept connections * @param context this is used for secure SSL connections * * @return this returns the actual local address that is used */ public SocketAddress listen(SocketAddress address, SSLContext context) throws IOException { SocketListener listener = new SocketListener(address, processor, analyzer, context); if(processor != null) { listener.process(); listeners.add(listener); } return listener.getAddress(); }
/** * This creates a new background task that will listen to the * specified <code>ServerAddress</code> for incoming TCP connect * requests. When an connection is accepted it is handed to the * internal <code>Server</code> implementation as a pipeline. The * background task is a non daemon task to ensure the server is * kept active, to terminate the connection this can be closed. * * @param address this is the address used to accept connections * @param context this is used for secure SSL connections * * @return this returns the actual local address that is used */ public SocketAddress listen(SocketAddress address, SSLContext context) throws IOException { SocketListener listener = new SocketListener(address, context, server, agent); if(server != null) { add(listener); } return listener.getAddress(); }
/** * Constructor for the <code>Listener</code> object. This needs * a socket address and a processor to hand created sockets * to. This creates a <code>Reactor</code> which will notify the * acceptor when there is a new connection waiting to be accepted. * * @param address this is the address to listen for new sockets * @param context this is the SSL context used for secure HTTPS * @param server this is the server that pipelines are handed to * @param agent this is used to create a trace to monitor events */ public SocketListener(SocketAddress address, SSLContext context, Server server, Agent agent) throws IOException { this.acceptor = new SocketAcceptor(address, context, server, agent); this.reactor = new DirectReactor(); this.process(); }
/** * This creates a new background task that will listen to the * specified <code>ServerAddress</code> for incoming TCP connect * requests. When an connection is accepted it is handed to the * internal socket connector. * * @param address this is the address used to accept connections * @param context this is used for secure SSL connections * * @return this returns the actual local address that is used */ public SocketAddress listen(SocketAddress address, SSLContext context) throws IOException { SocketListener listener = new SocketListener(address, processor, analyzer, context); if(processor != null) { listener.process(); listeners.add(listener); } return listener.getAddress(); }