Examples of AsynchronousSocketChannel


Examples of java.nio.channels.AsynchronousSocketChannel

    }

    public void sendMessages() throws Exception {
        channelGroup = AsynchronousChannelGroup.withThreadPool(Executors.newCachedThreadPool());
        String sampleMessage = "Text message sent from socket";
        AsynchronousSocketChannel socketChannel = null;
        for (int i = 0; i < numberMessages; i++) {
            Thread.sleep(1);
            socketChannel = AsynchronousSocketChannel.open(channelGroup);
            socketChannel.connect(new InetSocketAddress(host, port), null, getHandler(getByteBuffer(sampleMessage), socketChannel));
        }

        socketChannel = AsynchronousSocketChannel.open(channelGroup);
        socketChannel.connect(new InetSocketAddress(port), null, getHandler(getByteBuffer("quit"), socketChannel));
        channelGroup.shutdown();
    }
View Full Code Here

Examples of java.nio.channels.AsynchronousSocketChannel

                secure = true;
            }
            sa = new InetSocketAddress(host, port);
        }

        AsynchronousSocketChannel socketChannel;
        try {
            socketChannel = AsynchronousSocketChannel.open(getAsynchronousChannelGroup());
        } catch (IOException ioe) {
            throw new DeploymentException(sm.getString(
                    "wsWebSocketContainer.asynchronousSocketChannelFail"), ioe);
        }

        Future<Void> fConnect = socketChannel.connect(sa);

        AsyncChannelWrapper channel;
        if (secure) {
            SSLEngine sslEngine = createSSLEngine(
                    clientEndpointConfiguration.getUserProperties());
View Full Code Here

Examples of java.nio.channels.AsynchronousSocketChannel

                secure = true;
            }
            sa = new InetSocketAddress(host, port);
        }

        AsynchronousSocketChannel socketChannel;
        try {
            socketChannel = AsynchronousSocketChannel.open(getAsynchronousChannelGroup());
        } catch (IOException ioe) {
            throw new DeploymentException(sm.getString(
                    "wsWebSocketContainer.asynchronousSocketChannelFail"), ioe);
        }

        Future<Void> fConnect = socketChannel.connect(sa);

        AsyncChannelWrapper channel;
        if (secure) {
            SSLEngine sslEngine = createSSLEngine(
                    clientEndpointConfiguration.getUserProperties());
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.