how to simulate lack of network connectivity in unit testing
问题 The general question is how to simulate (as part of a JUnit suite of test cases) lack of network connectivity as this is an important consideration in some test cases. Is there a way to do so via a Java API (or via a JVM option) so that certain test cases can be run under network dis-connectivity? (simulated or real?). The more specific case (if there is no generally applicable solution) is that I am doing a bunch of XML-file processing (including XSD-validation) and I need to ensure that