Fixed client reconnect

This commit is contained in:
nathan 2016-03-11 00:05:42 +01:00
parent 78fca36d30
commit 1e017804bb
2 changed files with 6 additions and 21 deletions

View File

@ -53,6 +53,8 @@ class EndPointClient<C extends Connection> extends EndPoint<C> implements Runnab
protected
void registerNextProtocol() {
this.registrationComplete = false; // always reset.
new Thread(this, "Bootstrap registration").start();
}

View File

@ -41,28 +41,11 @@ class ReconnectTest extends BaseTest {
configuration.host = host;
Server server = null;
Server server = new Server(configuration);
server.disableRemoteKeyValidation();
// try to reconnect 10 times
boolean success = false;
for (int i = 0; i < 10; i++) {
try {
server = new Server(configuration);
server.disableRemoteKeyValidation();
server.bind(false);
addEndPoint(server);
success = true;
break;
} catch (Throwable ignored) {
System.out.println("Retrying...");
Thread.sleep(4000);
}
}
if (!success) {
throw new RuntimeException("Unable to bind to TCP port. Aborting.");
}
server.bind(false);
addEndPoint(server);
server.listeners()
.add(new Listener<Object>() {