mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-12 10:15:52 +00:00
Orchid: allow creation of unconnected socket
This commit is contained in:
parent
99448b730a
commit
23da335e57
@ -26,10 +26,16 @@ public class OrchidSocketFactory extends SocketFactory {
|
|||||||
this.exceptionOnLocalBind = exceptionOnLocalBind;
|
this.exceptionOnLocalBind = exceptionOnLocalBind;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Socket createSocket() throws IOException {
|
||||||
|
return createSocketInstance();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Socket createSocket(String host, int port) throws IOException,
|
public Socket createSocket(String host, int port) throws IOException,
|
||||||
UnknownHostException {
|
UnknownHostException {
|
||||||
return createOrchidSocket(host, port);
|
final Socket s = createSocketInstance();
|
||||||
|
return connectOrchidSocket(s, host, port);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -43,7 +49,8 @@ public class OrchidSocketFactory extends SocketFactory {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Socket createSocket(InetAddress address, int port) throws IOException {
|
public Socket createSocket(InetAddress address, int port) throws IOException {
|
||||||
return createOrchidSocket(address.getHostAddress(), port);
|
final Socket s = createSocketInstance();
|
||||||
|
return connectOrchidSocket(s, address.getHostAddress(), port);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -55,8 +62,7 @@ public class OrchidSocketFactory extends SocketFactory {
|
|||||||
return createSocket(address, port);
|
return createSocket(address, port);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Socket createOrchidSocket(String host, int port) throws IOException {
|
private Socket connectOrchidSocket(Socket s, String host, int port) throws IOException {
|
||||||
final Socket s = createSocketInstance();
|
|
||||||
final SocketAddress endpoint = InetSocketAddress.createUnresolved(host, port);
|
final SocketAddress endpoint = InetSocketAddress.createUnresolved(host, port);
|
||||||
s.connect(endpoint);
|
s.connect(endpoint);
|
||||||
return s;
|
return s;
|
||||||
|
@ -53,13 +53,16 @@ public class OrchidSocketImpl extends SocketImpl {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void connect(String host, int port) throws IOException {
|
protected void connect(String host, int port) throws IOException {
|
||||||
throw new UnsupportedOperationException();
|
SocketAddress endpoint =
|
||||||
|
InetSocketAddress.createUnresolved(host, port);
|
||||||
|
connect(endpoint, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void connect(InetAddress address, int port) throws IOException {
|
protected void connect(InetAddress address, int port) throws IOException {
|
||||||
throw new UnsupportedOperationException();
|
SocketAddress endpoint =
|
||||||
|
InetSocketAddress.createUnresolved(address.getHostAddress(), port);
|
||||||
|
connect(endpoint, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user