Search in sources :

Example 6 with TCPServerChannel

use of org.webpieces.nio.api.channels.TCPServerChannel in project webpieces by deanhiller.

the class TestExample method startServer.

private InetSocketAddress startServer() throws Exception {
    TCPServerChannel server = svc.createTCPServerChannel("server", null);
    // bind to 0 allows it to bind to any port...
    server.bind(new InetSocketAddress(0));
    server.registerServerSocketChannel(new MyServerSocketListener());
    return server.getLocalAddress();
}
Also used : InetSocketAddress(java.net.InetSocketAddress) TCPServerChannel(org.webpieces.nio.api.channels.TCPServerChannel)

Example 7 with TCPServerChannel

use of org.webpieces.nio.api.channels.TCPServerChannel in project webpieces by deanhiller.

the class TestExampleSessions method startServer.

private InetSocketAddress startServer() throws Exception {
    TCPServerChannel server = svc.createTCPServerChannel("server", null);
    // bind to 0 allows it to bind to any port...
    server.bind(new InetSocketAddress(0));
    server.registerServerSocketChannel(new MyServerSocketListener());
    return server.getLocalAddress();
}
Also used : InetSocketAddress(java.net.InetSocketAddress) TCPServerChannel(org.webpieces.nio.api.channels.TCPServerChannel)

Aggregations

TCPServerChannel (org.webpieces.nio.api.channels.TCPServerChannel)7 InetSocketAddress (java.net.InetSocketAddress)5 ByteBuffer (java.nio.ByteBuffer)2 Test (org.junit.Test)2 TCPChannel (org.webpieces.nio.api.channels.TCPChannel)2 InetAddress (java.net.InetAddress)1 Channel (org.webpieces.nio.api.channels.Channel)1 ChannelService (org.webpieces.nio.api.deprecated.ChannelService)1 Settings (org.webpieces.nio.api.deprecated.Settings)1 SSLEngineFactory (org.webpieces.nio.api.libs.SSLEngineFactory)1 MockSSLEngineFactory (org.webpieces.nio.api.testutil.MockSSLEngineFactory)1