VersionedConnection getConnection() throws IOException { sendVersionHeader(); IoFuture<Void> futureWelcome = WelcomeMessageReceiver.awaitWelcomeMessage(channel); IoFuture.Status result = futureWelcome.await(timeoutSeconds, TimeUnit.SECONDS); switch (result) { case DONE: // Set this first as something will need to start handling the response messages. channel.receiveMessage(new MessageReceiver()); break; case FAILED: throw futureWelcome.getException(); default: throw new IOException("Unable to obtain connectionId, status=" + result.toString()); } sendKeyPairs(); String connectionId = begin(); ClientConnection cc = new ClientConnection(channel, environment, clientRequestManager, clientExecutorManager, connectionId); cc.start(); return cc; }
VersionedConnection getConnection() throws IOException { sendVersionHeader(); IoFuture<Void> futureWelcome = WelcomeMessageReceiver.awaitWelcomeMessage(channel); IoFuture.Status result = futureWelcome.await(timeoutSeconds, TimeUnit.SECONDS); switch (result) { case DONE: // Set this first as something will need to start handling the response messages. channel.receiveMessage(new MessageReceiver()); break; case FAILED: throw futureWelcome.getException(); default: throw new IOException("Unable to obtain connectionId, status=" + result.toString()); } sendKeyPairs(); String connectionId = begin(); ClientConnection cc = new ClientConnection(channel, environment, clientRequestManager, clientExecutorManager, connectionId); cc.start(); return cc; }
VersionedConnection getConnection() throws IOException { sendVersionHeader(); IoFuture<Void> futureWelcome = WelcomeMessageReceiver.awaitWelcomeMessage(channel); IoFuture.Status result = futureWelcome.await(timeoutSeconds, TimeUnit.SECONDS); switch (result) { case DONE: // Set this first as something will need to start handling the response messages. channel.receiveMessage(new MessageReceiver()); break; case FAILED: throw futureWelcome.getException(); default: throw new IOException("Unable to obtain connectionId, status=" + result.toString()); } sendKeyPairs(); String connectionId = begin(); ClientConnection cc = new ClientConnection(channel, environment, clientRequestManager, clientExecutorManager, connectionId); cc.start(); return cc; }