Package java.nio.channels

Examples of java.nio.channels.SocketChannel.finishConnect()


            try {
              outboundChannel.configureBlocking(false);
              // not so useful because it's 2 hours timeout :(
              outboundChannel.socket().setKeepAlive(true);
              final Address clientAddress = new Address(outboundChannel.socket().getInetAddress().getHostAddress(), outboundChannel.socket().getPort());
              outboundChannel.finishConnect();
              final SelectionKey selectionKey = outboundChannel.register(selector, 0);
             
              final LinkedList<ByteBuffer> toWriteQueue = new LinkedList<ByteBuffer>();
             
              final CloseableByteBufferHandler read = listening.connected(clientAddress, new CloseableByteBufferHandler() {
View Full Code Here


        // Why we just have to do this once, here
        updateNow();
        for (SelectionKey k : selected) {
            SocketChannel sc = ((SocketChannel) k.channel());
            if ((k.readyOps() & SelectionKey.OP_CONNECT) != 0) {
                if (sc.finishConnect()) {
                    updateLastSendAndHeard();
                    sendThread.primeConnection();
                }
            } else if ((k.readyOps() & (SelectionKey.OP_READ | SelectionKey.OP_WRITE)) != 0) {
                doIO(pendingQueue, outgoingQueue, cnxn);
View Full Code Here

            SocketChannel ch = (SocketChannel) key.channel();
            ConnectionRequest entry = (ConnectionRequest) key.attachment();

            boolean success = false;
            try {
                ch.finishConnect();
                newSession(ch, entry.handler, entry.config, entry);
                success = true;
            } catch (Throwable e) {
                entry.setException(e);
            } finally {
View Full Code Here

            SocketChannel ch = ( SocketChannel ) key.channel();
            ConnectionRequest entry = ( ConnectionRequest ) key.attachment();

            try
            {
                ch.finishConnect();
                SocketSession session = newSession( ch, entry.handler );
                entry.session = session;
            }
            catch( Throwable e )
            {
View Full Code Here

            SocketChannel ch = ( SocketChannel ) key.channel();
            ConnectionRequest entry = ( ConnectionRequest ) key.attachment();

            try
            {
                ch.finishConnect();
                SocketSession session = newSession( ch, entry.handler );
                entry.session = session;
            }
            catch( Throwable e )
            {
View Full Code Here

            ConnectionRequest entry = ( ConnectionRequest ) key.attachment();

            boolean success = false;
            try
            {
                ch.finishConnect();
                SocketSessionImpl session = newSession( ch, entry.handler, entry.config );
                entry.setSession( session );
                success = true;
            }
            catch( Throwable e )
View Full Code Here

            // select again, it should return 0
            count = selectOnce(type, timeout);
            assertEquals(0, count);
            // but selectedKeys remains the same as previous
            assertSame(selectedKeys, selector.selectedKeys());
            sc.finishConnect();           
            selectedKeys.clear();
        } finally {
            try {
                ssc.accept().close();
            } catch (Exception e) {
View Full Code Here

       
        int validOps = channel.validOps ();
        System.out.println (validOps);
       
        if (! checkEligibility (channel)) {
            channel.finishConnect ();
            selector.close ();
            return ;
        }
       
        if (channel.isConnectionPending()){
View Full Code Here

            return ;
        }
       
        if (channel.isConnectionPending()){
            System.out.println("Client와의 연결 설정을 마무리 중입니다~");
            channel.finishConnect();
        }
       
        if (welcomeMsg == null || welcomeMsg.isEmpty ()) {
            welcomeMsg = languageResource.getString ("defWelcome").replace
            ("%roomName", serverName) ;
View Full Code Here

            ConnectionRequest entry = ( ConnectionRequest ) key.attachment();

            boolean success = false;
            try
            {
                ch.finishConnect();
                SocketSessionImpl session = newSession( ch, entry.handler, entry.config );
                entry.setSession( session );
                success = true;
            }
            catch( Throwable e )
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.