// Code from URLConnection checking that user has the right to // modify the factory that produces Socket Objects. // It throws a SecurityException if you don't have sufficient privilege. SecurityManager security = System.getSecurityManager(); if ( security != null ) { security.checkSetFactory(); }