Fixed client reconnect
This commit is contained in:
parent
78fca36d30
commit
1e017804bb
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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>() {
|
||||
|
|
Loading…
Reference in New Issue
Block a user