X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fnet%2Fpterodactylus%2Ffcp%2Fhighlevel%2FHighLevelClient.java;h=93378d34bea36c2df823a440833804e11ef5d41d;hb=b188a5d4f66c1bc99d5e9695f97fe317393da931;hp=a347e68e53f6fb2253cb785470b7eef85766a8d5;hpb=5f2cf2dc2269c59ad3fbcc0e8bdf822bbb6aed23;p=jFCPlib.git diff --git a/src/net/pterodactylus/fcp/highlevel/HighLevelClient.java b/src/net/pterodactylus/fcp/highlevel/HighLevelClient.java index a347e68..93378d3 100644 --- a/src/net/pterodactylus/fcp/highlevel/HighLevelClient.java +++ b/src/net/pterodactylus/fcp/highlevel/HighLevelClient.java @@ -303,13 +303,18 @@ public class HighLevelClient { * if an I/O error occurs communicating with the node */ public HighLevelCallback connect(InetAddress address, int port) throws IOException { - fcpConnection = new FcpConnection(address, port); - fcpConnection.addFcpListener(highLevelClientFcpListener); - fcpConnection.connect(); - ClientHello clientHello = new ClientHello(clientName); - connectCallback = new HighLevelCallback(new ConnectResult()); - fcpConnection.sendMessage(clientHello); - return connectCallback; + try { + fcpConnection = new FcpConnection(address, port); + fcpConnection.addFcpListener(highLevelClientFcpListener); + fcpConnection.connect(); + ClientHello clientHello = new ClientHello(clientName); + connectCallback = new HighLevelCallback(new ConnectResult()); + fcpConnection.sendMessage(clientHello); + return connectCallback; + } catch (IOException ioe1) { + fcpConnection = null; + throw ioe1; + } } /**