/** * Binds to the given port and starts accepting new client connections. * @throws Exception If binding to the given port fails (eg SocketException: Permission denied for privileged ports) */ public void bindAndStart(int port) throws Exception { server = new NioServer(new StreamConnectionFactory() { @Override public ProtobufConnection<Protos.TwoWayChannelMessage> getNewConnection(InetAddress inetAddress, int port) { return new ServerHandler(new InetSocketAddress(inetAddress, port), timeoutSeconds).socketProtobufHandler; } }, new InetSocketAddress(port)); server.startAsync(); server.awaitRunning(); }
/** * Binds to the given port and starts accepting new client connections. * @throws Exception If binding to the given port fails (eg SocketException: Permission denied for privileged ports) */ public void bindAndStart(int port) throws Exception { server = new NioServer(new StreamConnectionFactory() { @Override public ProtobufConnection<Protos.TwoWayChannelMessage> getNewConnection(InetAddress inetAddress, int port) { return new ServerHandler(new InetSocketAddress(inetAddress, port), timeoutSeconds).socketProtobufHandler; } }, new InetSocketAddress(port)); server.startAsync(); server.awaitRunning(); }
/** * Binds to the given port and starts accepting new client connections. * @throws Exception If binding to the given port fails (eg SocketException: Permission denied for privileged ports) */ public void bindAndStart(int port) throws Exception { server = new NioServer(new StreamConnectionFactory() { @Override public ProtobufConnection<Protos.TwoWayChannelMessage> getNewConnection(InetAddress inetAddress, int port) { return new ServerHandler(new InetSocketAddress(inetAddress, port), timeoutSeconds).socketProtobufHandler; } }, new InetSocketAddress(port)); server.startAsync(); server.awaitRunning(); }
/** * Binds to the given port and starts accepting new client connections. * @throws Exception If binding to the given port fails (eg SocketException: Permission denied for privileged ports) */ public void bindAndStart(int port) throws Exception { server = new NioServer(new StreamConnectionFactory() { @Override public ProtobufConnection<Protos.TwoWayChannelMessage> getNewConnection(InetAddress inetAddress, int port) { return new ServerHandler(new InetSocketAddress(inetAddress, port), timeoutSeconds).socketProtobufHandler; } }, new InetSocketAddress(port)); server.startAsync(); server.awaitRunning(); }
protected void startPeerServer(int i) throws IOException { peerServers[i] = new NioServer(new StreamConnectionFactory() { @Nullable @Override public StreamConnection getNewConnection(InetAddress inetAddress, int port) { return new InboundMessageQueuer(PARAMS) { @Override public void connectionClosed() { } @Override public void connectionOpened() { newPeerWriteTargetQueue.offer(this); } }; } }, new InetSocketAddress("127.0.0.1", 2000 + i)); peerServers[i].startAsync(); peerServers[i].awaitRunning(); }
final SettableFuture<Void> serverConnection2Closed = SettableFuture.create(); final SettableFuture<Void> clientConnection2Closed = SettableFuture.create(); NioServer server = new NioServer(new StreamConnectionFactory() { @Override public ProtobufConnection<TwoWayChannelMessage> getNewConnection(InetAddress inetAddress, int port) {
final SettableFuture<Protos.TwoWayChannelMessage> clientMessage1Received = SettableFuture.create(); final SettableFuture<Protos.TwoWayChannelMessage> clientMessage2Received = SettableFuture.create(); NioServer server = new NioServer(new StreamConnectionFactory() { @Override public ProtobufConnection<TwoWayChannelMessage> getNewConnection(InetAddress inetAddress, int port) {
final SettableFuture<Protos.TwoWayChannelMessage> client2MessageReceived = SettableFuture.create(); final SettableFuture<Protos.TwoWayChannelMessage> client3MessageReceived = SettableFuture.create(); NioServer server = new NioServer(new StreamConnectionFactory() { @Override public ProtobufConnection<TwoWayChannelMessage> getNewConnection(InetAddress inetAddress, int port) {
final SettableFuture<Protos.TwoWayChannelMessage> clientMessage3Received = SettableFuture.create(); final SettableFuture<Protos.TwoWayChannelMessage> clientMessage4Received = SettableFuture.create(); NioServer server = new NioServer(new StreamConnectionFactory() { @Override public ProtobufConnection<TwoWayChannelMessage> getNewConnection(InetAddress inetAddress, int port) {
final SettableFuture<Void> serverConnectionClosed = SettableFuture.create(); final SettableFuture<Void> client2Disconnected = SettableFuture.create(); NioServer server = new NioServer(new StreamConnectionFactory() { boolean finishedFirst = false; @Override