// wait while server and proxy run
server.join();
proxy.join();
assertTrue("Connection does not use proxy", connection.usingProxy());
assertTrue("Proxy server was not used", proxy.accepted);
} finally {
// restore default proxy selector
ProxySelector.setDefault(defPS);
}