/** * Sets the <code>SocketImplFactory</code>. This may be done only once per virtual machine. * Subsequent attempts will generate a <code>SocketException</code>. Note that a <code> * SecurityManager</code> check is made prior to setting the factory. If insufficient privileges * exist to set the factory, then an <code>IOException</code> will be thrown. * * @exception SecurityException If the <code>SecurityManager</code> does not allow this operation. * @exception SocketException If the SocketImplFactory is already defined * @exception IOException If any other error occurs */ public static synchronized void setSocketImplFactory(SocketImplFactory fac) throws IOException { // See if already set if (factory != null) throw new SocketException("SocketImplFactory already defined"); // Check permissions SecurityManager sm = System.getSecurityManager(); if (sm != null) sm.checkSetFactory(); if (fac == null) throw new SocketException("SocketImplFactory cannot be null"); factory = fac; }