Open effad opened 1 year ago
Technically you can try to workaround be implementing a
public class ConnectTimeoutSocket extends Socket {
@Override
public void connect(SocketAddress endpoint) throws IOException {
connect(endpoint, 10000);
}
}
and
public class ConnectTimoutSocketFactory implements SocketFactory {
@Override
public Socket createSocket() throws IOException {
return new ConnectTimeoutSocket();
}
...
but this seems very hacky ...
Consider this example:
since google.com will not answer the attempt to connect, the program will wait forever (i.e. hang). There seems to be no way to fix the problem, since
ca.uhn.hl7v2.app.ConnectionFactory.createSocket(SocketFactory, String, int, boolean)
callssocket.connect(new InetSocketAddress(host, port));
, which will in fact wait forever for the connection to be established.ConnectionFactory
cannot be overridden (all static methods), so it seems we're out of luck and would require to implement a completely new HapiContext.