Package org.apache.http.nio.reactor

Examples of org.apache.http.nio.reactor.ListeningIOReactor.listen()


        assertEquals(0, endpoints.size());
       
        ListenerEndpoint port9998 = ioreactor.listen(new InetSocketAddress(9998));
        port9998.waitFor();

        ListenerEndpoint port9999 = ioreactor.listen(new InetSocketAddress(9999));
        port9999.waitFor();

        endpoints = ioreactor.getEndpoints();
        assertNotNull(endpoints);
        assertEquals(2, endpoints.size());
View Full Code Here


        try {
            output.append(Utils.getCurrentTimeToString() + ":开启服务器,端口:9999\n");
            output.setCaretPosition(output.getText().length());
            ListeningIOReactor ioReactor = new DefaultListeningIOReactor(2, params);
            ioReactor.listen(new InetSocketAddress(port));
            ioReactor.execute(ioEventDispatch);
        } catch (InterruptedIOException ex) {
            System.err.println("Interrupted");
        } catch (IOException e) {
            System.err.println("I/O error: " + e.getMessage());
View Full Code Here

           
        });
        t.start();
       
        try {
            listeningIOReactor.listen(new InetSocketAddress(8888));
            listeningIOReactor.execute(listeningEventDispatch);
        } catch (InterruptedIOException ex) {
            System.err.println("Interrupted");
        } catch (IOException e) {
            System.err.println("I/O error: " + e.getMessage());
View Full Code Here

        handler.setEventListener(new EventLogger());
       
        IOEventDispatch ioEventDispatch = new DefaultServerIOEventDispatch(handler, params);
        ListeningIOReactor ioReactor = new DefaultListeningIOReactor(2, params);
        try {
            ioReactor.listen(new InetSocketAddress(8080));
            ioReactor.execute(ioEventDispatch);
        } catch (InterruptedIOException ex) {
            System.err.println("Interrupted");
        } catch (IOException e) {
            System.err.println("I/O error: " + e.getMessage());
View Full Code Here

    public static void main(String[] args) throws Exception {
        HttpParams params = new BasicHttpParams();
        IOEventDispatch ioEventDispatch = new DefaultIoEventDispatch();
        ListeningIOReactor ioReactor = new DefaultListeningIOReactor(2, params);
        ioReactor.listen(new InetSocketAddress(8080));
        try {
            ioReactor.execute(ioEventDispatch);
        } catch (InterruptedIOException ex) {
            System.err.println("Interrupted");
        } catch (IOException e) {
View Full Code Here

                sslcontext,
                params);
       
        ListeningIOReactor ioReactor = new DefaultListeningIOReactor(2, params);
        try {
            ioReactor.listen(new InetSocketAddress(8080));
            ioReactor.execute(ioEventDispatch);
        } catch (InterruptedIOException ex) {
            System.err.println("Interrupted");
        } catch (IOException e) {
            System.err.println("I/O error: " + e.getMessage());
View Full Code Here

        Set<ListenerEndpoint> endpoints = ioreactor.getEndpoints();
        Assert.assertNotNull(endpoints);
        Assert.assertEquals(0, endpoints.size());

        ListenerEndpoint port9998 = ioreactor.listen(new InetSocketAddress(9998));
        port9998.waitFor();

        ListenerEndpoint port9999 = ioreactor.listen(new InetSocketAddress(9999));
        port9999.waitFor();
View Full Code Here

        Assert.assertEquals(0, endpoints.size());

        ListenerEndpoint port9998 = ioreactor.listen(new InetSocketAddress(9998));
        port9998.waitFor();

        ListenerEndpoint port9999 = ioreactor.listen(new InetSocketAddress(9999));
        port9999.waitFor();

        endpoints = ioreactor.getEndpoints();
        Assert.assertNotNull(endpoints);
        Assert.assertEquals(2, endpoints.size());
View Full Code Here

        });

        t.start();

        ListenerEndpoint endpoint1 = ioreactor.listen(new InetSocketAddress(9999));
        endpoint1.waitFor();

        ListenerEndpoint endpoint2 = ioreactor.listen(new InetSocketAddress(9999));
        endpoint2.waitFor();
        Assert.assertNotNull(endpoint2.getException());
View Full Code Here

        t.start();

        ListenerEndpoint endpoint1 = ioreactor.listen(new InetSocketAddress(9999));
        endpoint1.waitFor();

        ListenerEndpoint endpoint2 = ioreactor.listen(new InetSocketAddress(9999));
        endpoint2.waitFor();
        Assert.assertNotNull(endpoint2.getException());

        // I/O reactor is now expected to be shutting down
        latch.await(2000, TimeUnit.MILLISECONDS);
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.