diff --git a/src/main/java/com/sparrowwallet/sparrow/net/Protocol.java b/src/main/java/com/sparrowwallet/sparrow/net/Protocol.java index 37c34d86..81c62c1f 100644 --- a/src/main/java/com/sparrowwallet/sparrow/net/Protocol.java +++ b/src/main/java/com/sparrowwallet/sparrow/net/Protocol.java @@ -129,7 +129,9 @@ public enum Protocol { public abstract CloseableTransport getTransport(HostAndPort server, File serverCert, HostAndPort proxy) throws IOException, CertificateException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException; public HostAndPort getServerHostAndPort(String url) { - return HostAndPort.fromString(url.substring(this.toUrlString().length())); + String lessProtocol = url.substring(this.toUrlString().length()); + int pathStart = lessProtocol.indexOf('/'); + return HostAndPort.fromString(pathStart < 0 ? lessProtocol : lessProtocol.substring(0, pathStart)); } public String toUrlString() {