Examples of IOSession


Examples of org.apache.http.nio.reactor.IOSession

            }
        }
    }

    private void processClosedSessions() {
        IOSession session;
        while ((session = this.closedSessions.poll()) != null) {
            if (this.sessions.remove(session)) {
                sessionClosed(session);
            }
        }
View Full Code Here

Examples of org.apache.mina.api.IoSession

        ServerSocket server = new ServerSocket();
        try {
            server.bind(null);
            IoFuture<IoSession> cf = client.connect(new InetSocketAddress("localhost", server.getLocalPort()));
            Thread.sleep(5000);
            IoSession session = cf.get();
            System.err.println(session);
            Assert.fail();
        } catch (ExecutionException ex) {
            // happy
            ex.printStackTrace();
View Full Code Here

Examples of org.apache.mina.api.IoSession

    @SuppressWarnings("rawtypes")
    private RequestFilter rq = new RequestFilter();

    @Test
    public void session_open_initialize_in_flight_container() {
        IoSession session = mock(IoSession.class);

        // run
        rq.sessionOpened(session);

        // verify
View Full Code Here

Examples of org.apache.mina.api.IoSession

    }

    @SuppressWarnings({ "rawtypes", "unchecked" })
    @Test
    public void request_and_produce_a_future() {
        IoSession session = mock(IoSession.class);

        Request r = mock(Request.class);
        when(r.requestId()).thenReturn("ID");

        Map m = mock(Map.class);

        when(session.getAttribute(RequestFilter.IN_FLIGHT_REQUESTS)).thenReturn(m);

        // run
        IoFuture f = rq.request(session, r, 12345);

        // verify
View Full Code Here

Examples of org.apache.mina.api.IoSession

    }

    @SuppressWarnings({ "rawtypes", "unchecked" })
    @Test
    public void receive_a_messagre_and_find_the_future_to_complete() {
        IoSession session = mock(IoSession.class);

        Response r = mock(Response.class);
        when(r.requestId()).thenReturn("ID");

        Map m = mock(Map.class);

        when(session.getAttribute(RequestFilter.IN_FLIGHT_REQUESTS)).thenReturn(m);

        RequestFuture f = mock(RequestFuture.class);

        when(m.remove("ID")).thenReturn(f);
View Full Code Here

Examples of org.apache.mina.api.IoSession

        });

        IoFuture<IoSession> future = udpClient.connect(new InetSocketAddress(port));

        try {
            IoSession session = future.get();
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (ExecutionException e) {
            // TODO Auto-generated catch block
View Full Code Here

Examples of org.apache.mina.api.IoSession

    @Test
    public void execute_open_events() throws InterruptedException {
        // prepare
        executor = new OrderedHandlerExecutor(1, 1);
        IoSession session = mock(IoSession.class);
        when(session.getId()).thenReturn(12345L);

        Event evt = mock(Event.class);
        when(evt.getSession()).thenReturn(session);

        // run
View Full Code Here

Examples of org.apache.mina.api.IoSession

    @Test
    public void create_states() {
        // prepare
        Object decodingState = new Object();
        Object encodingState = new Object();
        IoSession session = mock(IoSession.class);

        when(decoder.createDecoderState()).thenReturn(decodingState);
        when(encoder.createEncoderState()).thenReturn(encodingState);

        // run
View Full Code Here

Examples of org.apache.mina.api.IoSession

    }

    @Test
    public void loop_decode_twice() {
        // prepare
        IoSession session = mock(IoSession.class);
        ByteBuffer buff = ByteBuffer.wrap("test".getBytes());

        Object decodingState = new Object();

        when(session.getAttribute(new AttributeKey<Object>(Object.class, "internal_decoder")))
                .thenReturn(decodingState);

        Object decoded = new Object();

        when(decoder.decode(buff, decodingState)).thenReturn(decoded).thenReturn(decoded).thenReturn(null);
View Full Code Here

Examples of org.apache.mina.api.IoSession

    }

    @Test
    public void encode() {
        // prepare
        IoSession session = mock(IoSession.class);
        ByteBuffer buff = ByteBuffer.wrap("test".getBytes());
        Object encodingState = new Object();

        when(session.getAttribute(new AttributeKey<Object>(Object.class, "internal_encoder")))
                .thenReturn(encodingState);

        Object toEncode = new Object();
        WriteRequest wrq = mock(WriteRequest.class);
        when(wrq.getMessage()).thenReturn(toEncode);
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.