X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Ffcp%2Fquelaton%2FClientHelloImpl.java;h=3ded685a0c4877af938292fcb23ad28e4601c5f4;hb=f85a8ea030d563b573acca6f1a117ec87c82cc4e;hp=c093e89830ec2d22b5d2f1f3b07dccee33aa78ea;hpb=ff2e4b93bfb1030fd11ec295f4ae6e9bd29b6966;p=jFCPlib.git
diff --git a/src/main/java/net/pterodactylus/fcp/quelaton/ClientHelloImpl.java b/src/main/java/net/pterodactylus/fcp/quelaton/ClientHelloImpl.java
index c093e89..3ded685 100644
--- a/src/main/java/net/pterodactylus/fcp/quelaton/ClientHelloImpl.java
+++ b/src/main/java/net/pterodactylus/fcp/quelaton/ClientHelloImpl.java
@@ -3,11 +3,9 @@ package net.pterodactylus.fcp.quelaton;
import java.io.IOException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
-import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import net.pterodactylus.fcp.ClientHello;
-import net.pterodactylus.fcp.CloseConnectionDuplicateClientName;
import net.pterodactylus.fcp.FcpConnection;
import net.pterodactylus.fcp.NodeHello;
@@ -16,7 +14,7 @@ import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
/**
- * Internal ClientHello
implementation based on {@link FcpReplySequence}.
+ * Internal ClientHello
implementation based on {@link FcpDialog}.
*
* @author David âBombeâ Roden
*/
@@ -39,15 +37,14 @@ public class ClientHelloImpl {
}
private ListenableFuture execute() {
- return threadPool.submit(() -> establishConnection());
+ return threadPool.submit(this::establishConnection);
}
private FcpConnection establishConnection() throws IOException {
FcpConnection connection = new FcpConnection(hostname, port);
connection.connect();
- ClientHelloReplySequence nodeHelloSequence = new ClientHelloReplySequence(connection);
ClientHello clientHello = new ClientHello(clientName.get(), "2.0");
- try {
+ try (ClientHelloDialog nodeHelloSequence = new ClientHelloDialog(connection)) {
if (nodeHelloSequence.send(clientHello).get()) {
return connection;
}
@@ -59,11 +56,11 @@ public class ClientHelloImpl {
throw new IOException(String.format("Could not connect to %s:%d.", hostname, port));
}
- private class ClientHelloReplySequence extends FcpReplySequence {
+ private class ClientHelloDialog extends FcpDialog {
private final AtomicReference receivedNodeHello = new AtomicReference<>();
- public ClientHelloReplySequence(FcpConnection connection) {
+ public ClientHelloDialog(FcpConnection connection) {
super(ClientHelloImpl.this.threadPool, connection);
}