mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-12 02:05:53 +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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Socket createSocket() throws IOException {
|
||||
return createSocketInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Socket createSocket(String host, int port) throws IOException,
|
||||
UnknownHostException {
|
||||
return createOrchidSocket(host, port);
|
||||
final Socket s = createSocketInstance();
|
||||
return connectOrchidSocket(s, host, port);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -43,7 +49,8 @@ public class OrchidSocketFactory extends SocketFactory {
|
||||
|
||||
@Override
|
||||
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
|
||||
@ -55,8 +62,7 @@ public class OrchidSocketFactory extends SocketFactory {
|
||||
return createSocket(address, port);
|
||||
}
|
||||
|
||||
private Socket createOrchidSocket(String host, int port) throws IOException {
|
||||
final Socket s = createSocketInstance();
|
||||
private Socket connectOrchidSocket(Socket s, String host, int port) throws IOException {
|
||||
final SocketAddress endpoint = InetSocketAddress.createUnresolved(host, port);
|
||||
s.connect(endpoint);
|
||||
return s;
|
||||
|
@ -53,13 +53,16 @@ public class OrchidSocketImpl extends SocketImpl {
|
||||
|
||||
@Override
|
||||
protected void connect(String host, int port) throws IOException {
|
||||
throw new UnsupportedOperationException();
|
||||
SocketAddress endpoint =
|
||||
InetSocketAddress.createUnresolved(host, port);
|
||||
connect(endpoint, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void connect(InetAddress address, int port) throws IOException {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
SocketAddress endpoint =
|
||||
InetSocketAddress.createUnresolved(address.getHostAddress(), port);
|
||||
connect(endpoint, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user