Example usage for java.net URL setURLStreamHandlerFactory

List of usage examples for java.net URL setURLStreamHandlerFactory

Introduction

In this page you can find the example usage for java.net URL setURLStreamHandlerFactory.

Prototype

public static void setURLStreamHandlerFactory(URLStreamHandlerFactory fac) 

Source Link

Document

Sets an application's URLStreamHandlerFactory .

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {
    URL.setURLStreamHandlerFactory(new URLStreamHandlerFactory());
}

From source file:org.talend.components.api.component.runtime.JarRuntimeInfoTest.java

@BeforeClass
public static void setupMavenUrlHandler() {
    try {/*  w ww  . j a va 2 s  . c o m*/
        new URL("mvn:foo/bar");
    } catch (MalformedURLException e) {
        // handles mvn local repository
        String mvnLocalRepo = System.getProperty("maven.repo.local");
        if (mvnLocalRepo != null) {
            System.setProperty("org.ops4j.pax.url.mvn.localRepository", mvnLocalRepo);
        }
        URL.setURLStreamHandlerFactory(new URLStreamHandlerFactory() {

            @Override
            public URLStreamHandler createURLStreamHandler(String protocol) {
                if (ServiceConstants.PROTOCOL.equals(protocol)) {
                    return new Handler();
                } else {
                    return null;
                }
            }
        });
    }
}

From source file:org.calrissian.mango.jms.stream.JmsFileTransferSupportTest.java

public void testFullCycle() throws Exception {
    try {//from  ww w  .  ja  v  a 2 s. c  om
        URL.setURLStreamHandlerFactory(new URLStreamHandlerFactory() {

            @Override
            public URLStreamHandler createURLStreamHandler(String protocol) {
                if ("testprot".equals(protocol))
                    return new URLStreamHandler() {

                        @Override
                        protected URLConnection openConnection(URL u) throws IOException {
                            return new URLConnection(u) {

                                @Override
                                public void connect() throws IOException {

                                }

                                @Override
                                public InputStream getInputStream() throws IOException {
                                    return new ByteArrayInputStream(TEST_STR.getBytes());
                                }

                                @Override
                                public String getContentType() {
                                    return "content/notnull";
                                }
                            };
                        }
                    };
                return null;
            }
        });
    } catch (Error ignored) {
    }

    final ActiveMQTopic ft = new ActiveMQTopic("testFileTransfer");

    ThreadPoolTaskExecutor te = new ThreadPoolTaskExecutor();
    te.initialize();

    JmsFileSenderListener listener = new JmsFileSenderListener();
    final String hashAlgorithm = "MD5";
    listener.setHashAlgorithm(hashAlgorithm);
    listener.setStreamRequestDestination(ft);
    listener.setPieceSize(9);
    listener.setTaskExecutor(te);

    ConnectionFactory cf = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
    cf = new SingleTopicConnectionFactory(cf, "test");
    JmsTemplate jmsTemplate = new JmsTemplate();
    jmsTemplate.setConnectionFactory(cf);
    jmsTemplate.setReceiveTimeout(60000);
    listener.setJmsTemplate(jmsTemplate);

    Connection conn = cf.createConnection();
    conn.start();
    Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
    MessageConsumer consumer = sess.createConsumer(ft);
    consumer.setMessageListener(listener);

    JmsFileReceiver receiver = new JmsFileReceiver();
    receiver.setHashAlgorithm(hashAlgorithm);
    receiver.setStreamRequestDestination(ft);
    receiver.setJmsTemplate(jmsTemplate);
    receiver.setPieceSize(9);

    JmsFileReceiverInputStream stream = (JmsFileReceiverInputStream) receiver.receiveStream("testprot:test");
    StringBuilder buffer = new StringBuilder();
    int read;
    while ((read = stream.read()) >= 0) {
        buffer.append((char) read);
    }
    stream.close();

    assertEquals(TEST_STR, buffer.toString());

    conn.stop();

}

From source file:de.unidue.inf.is.ezdl.gframedl.EzDL.java

/**
 * Starts the application.//  w  w w.  j  av  a  2 s. co  m
 * 
 * @param args
 *            an array of command-line arguments
 * @param application
 *            the application
 */
static void start(String[] args, final Application application,
        final GraphicsConfiguration graphicsConfiguration) {
    if (!started) {
        started = true;

        parseCommandLine(args);

        URL.setURLStreamHandlerFactory(new InternalProtocolFactory());

        initLogging();

        if (System.getProperty("collection") != null) {
            logger.debug("Found Property: " + System.getProperty("collection"));
        }

        final Config config = Config.getInstance();

        SwingUtilities.invokeLater(new Runnable() {

            @Override
            public void run() {
                initDesktopSystem();

                application.setSessionType(sessionType);
                SplashScreen splashScreen = new DefaultSplashScreen(application, graphicsConfiguration,
                        sessionType);
                application.setSplashScreen(splashScreen);

                boolean autoLogin = config.getUserPropertyAsBoolean("autologin", false);
                if (!autoLogin) {
                    splashScreen.showSplash();
                } else {
                    autoLogin(splashScreen);
                }
            }
        });

    } else {
        throw new IllegalStateException("Already started");
    }
}

From source file:DummyAppletContext.java

private void init(Applet applet, int default_width, int default_height, String args[], int startidx) {

    URL.setURLStreamHandlerFactory(this);

    applets.addElement(applet);//  ww w .  j a v a2s.  co  m
    applet.setStub(this);

    initial_width = default_width;
    initial_height = default_height;

    parseArgs(args, startidx);

    status = new TextField();
    status.setEditable(false);

    add("Center", applet);
    add("South", status);

    appletResize(initial_width, initial_height);

    show();
    applet.init();
    applet.start();
}

From source file:com.samczsun.helios.bootloader.Bootloader.java

private static void loadSWTLibrary()
        throws IOException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
    String name = getOSName();//from   w  w w.ja va 2  s. c  o m
    if (name == null)
        throw new IllegalArgumentException("Cannot determine OS");
    String arch = getArch();
    if (arch == null)
        throw new IllegalArgumentException("Cannot determine architecture");

    String swtLocation = "/swt/org.eclipse.swt." + name + "." + arch + "-" + Constants.SWT_VERSION + ".jar";

    System.out.println("Loading SWT version " + swtLocation.substring(5));

    InputStream swtIn = Bootloader.class.getResourceAsStream(swtLocation);
    if (swtIn == null)
        throw new IllegalArgumentException("SWT library not found");
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    IOUtils.copy(swtIn, outputStream);
    ByteArrayInputStream swt = new ByteArrayInputStream(outputStream.toByteArray());

    URL.setURLStreamHandlerFactory(protocol -> { //JarInJar!
        if (protocol.equals("swt")) {
            return new URLStreamHandler() {
                protected URLConnection openConnection(URL u) {
                    return new URLConnection(u) {
                        public void connect() {
                        }

                        public InputStream getInputStream() {
                            return swt;
                        }
                    };
                }

                protected void parseURL(URL u, String spec, int start, int limit) {
                    // Don't parse or it's too slow
                }
            };
        }
        return null;
    });

    ClassLoader classLoader = Bootloader.class.getClassLoader();
    Method method = URLClassLoader.class.getDeclaredMethod("addURL", URL.class);
    method.setAccessible(true);
    method.invoke(classLoader, new URL("swt://load"));

    System.out.println("Loaded SWT Library");
}

From source file:io.dockstore.webservice.DockstoreWebserviceApplication.java

@Override
public void initialize(Bootstrap<DockstoreWebserviceConfiguration> bootstrap) {

    // setup hibernate+postgres
    bootstrap.addBundle(hibernate);/* w  ww.j  ava  2 s .  c  o m*/

    // serve static html as well
    bootstrap.addBundle(new AssetsBundle("/assets/", "/static/"));
    // enable views
    bootstrap.addBundle(new ViewBundle<>());

    // for database migrations.xml
    bootstrap.addBundle(new MigrationsBundle<DockstoreWebserviceConfiguration>() {
        @Override
        public DataSourceFactory getDataSourceFactory(DockstoreWebserviceConfiguration configuration) {
            return configuration.getDataSourceFactory();
        }
    });

    if (cache == null) {
        int cacheSize = CACHE_IN_MB * BYTES_IN_KILOBYTE * KILOBYTES_IN_MEGABYTE; // 100 MiB
        final File tempDir;
        try {
            tempDir = Files.createTempDirectory("dockstore-web-cache-").toFile();
        } catch (IOException e) {
            LOG.error("Could no create web cache");
            throw new RuntimeException(e);
        }
        cache = new Cache(tempDir, cacheSize);
    }
    // match HttpURLConnection which does not have a timeout by default
    OkHttpClient okHttpClient = new OkHttpClient().newBuilder().cache(cache).connectTimeout(0, TimeUnit.SECONDS)
            .readTimeout(0, TimeUnit.SECONDS).writeTimeout(0, TimeUnit.SECONDS).build();
    try {
        // this can only be called once per JVM, a factory exception is thrown in our tests
        URL.setURLStreamHandlerFactory(new OkUrlFactory(okHttpClient));
    } catch (Error factoryException) {
        if (factoryException.getMessage().contains("factory already defined")) {
            LOG.info("OkHttpClient already registered, skipping");
        } else {
            LOG.error("Could no create web cache, factory exception");
            throw new RuntimeException(factoryException);
        }
    }
}

From source file:com.jtechme.apphub.FDroidApp.java

@TargetApi(9)
@Override//from  ww  w.  ja  va 2s .c o m
public void onCreate() {
    if (Build.VERSION.SDK_INT >= 9 && BuildConfig.DEBUG) {
        StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectAll().penaltyLog().build());
        StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectAll().penaltyLog().build());
    }
    updateLanguage();
    super.onCreate();
    ACRA.init(this);

    // Needs to be setup before anything else tries to access it.
    // Perhaps the constructor is a better place, but then again,
    // it is more deterministic as to when this gets called...
    Preferences.setup(this);

    // Apply the Google PRNG fixes to properly seed SecureRandom
    PRNGFixes.apply();

    // Check that the installed app cache hasn't gotten out of sync somehow.
    // e.g. if we crashed/ran out of battery half way through responding
    // to a package installed intent. It doesn't really matter where
    // we put this in the bootstrap process, because it runs on a different
    // thread, which will be delayed by some seconds to avoid an error where
    // the database is locked due to the database updater.
    InstalledAppCacheUpdater.updateInBackground(getApplicationContext());

    // If the user changes the preference to do with filtering rooted apps,
    // it is easier to just notify a change in the app provider,
    // so that the newly updated list will correctly filter relevant apps.
    Preferences.get().registerAppsRequiringRootChangeListener(new Preferences.ChangeListener() {
        @Override
        public void onPreferenceChange() {
            getContentResolver().notifyChange(AppProvider.getContentUri(), null);
        }
    });

    // This is added so that the bluetooth:// scheme we use for URLs the BluetoothDownloader
    // understands is not treated as invalid by the java.net.URL class. The actual Handler does
    // nothing, but its presence is enough.
    URL.setURLStreamHandlerFactory(new URLStreamHandlerFactory() {
        @Override
        public URLStreamHandler createURLStreamHandler(String protocol) {
            return TextUtils.equals(protocol, "bluetooth") ? new Handler() : null;
        }
    });

    final Context context = this;
    Preferences.get().registerUnstableUpdatesChangeListener(new Preferences.ChangeListener() {
        @Override
        public void onPreferenceChange() {
            AppProvider.Helper.calcDetailsFromIndex(context);
        }
    });

    // Clear cached apk files. We used to just remove them after they'd
    // been installed, but this causes problems for proprietary gapps
    // users since the introduction of verification (on pre-4.2 Android),
    // because the install intent says it's finished when it hasn't.
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
    curTheme = Theme.valueOf(prefs.getString(Preferences.PREF_THEME, Preferences.DEFAULT_THEME));
    Utils.deleteFiles(Utils.getApkDownloadDir(this), null, ".apk");
    if (!Preferences.get().shouldCacheApks()) {
        Utils.deleteFiles(Utils.getApkCacheDir(this), null, ".apk");
    }

    // Index files which downloaded, but were not removed (e.g. due to F-Droid being force
    // closed during processing of the file, before getting a chance to delete). This may
    // include both "index-*-downloaded" and "index-*-extracted.xml" files. The first is from
    // either signed or unsigned repos, and the later is from signed repos.
    Utils.deleteFiles(getCacheDir(), "index-", null);

    // As above, but for legacy F-Droid clients that downloaded under a different name, and
    // extracted to the files directory rather than the cache directory.
    // TODO: This can be removed in a a few months or a year (e.g. 2016) because people will
    // have upgraded their clients, this code will have executed, and they will not have any
    // left over files any more. Even if they do hold off upgrading until this code is removed,
    // the only side effect is that they will have a few more MiB of storage taken up on their
    // device until they uninstall and re-install F-Droid.
    Utils.deleteFiles(getCacheDir(), "dl-", null);
    Utils.deleteFiles(getFilesDir(), "index-", null);

    UpdateService.schedule(getApplicationContext());
    bluetoothAdapter = getBluetoothAdapter();

    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext())
            .imageDownloader(new IconDownloader(getApplicationContext()))
            .diskCache(new LimitedAgeDiskCache(
                    new File(StorageUtils.getCacheDirectory(getApplicationContext(), true), "icons"), null,
                    new FileNameGenerator() {
                        @Override
                        public String generate(String imageUri) {
                            return imageUri.substring(imageUri.lastIndexOf('/') + 1);
                        }
                    },
                    // 30 days in secs: 30*24*60*60 = 2592000
                    2592000))
            .threadPoolSize(4).threadPriority(Thread.NORM_PRIORITY - 2) // Default is NORM_PRIORITY - 1
            .build();
    ImageLoader.getInstance().init(config);

    // TODO reintroduce PinningTrustManager and MemorizingTrustManager

    // initialized the local repo information
    FDroidApp.initWifiSettings();
    startService(new Intent(this, WifiStateChangeService.class));
    // if the HTTPS pref changes, then update all affected things
    Preferences.get().registerLocalRepoHttpsListeners(new ChangeListener() {
        @Override
        public void onPreferenceChange() {
            startService(new Intent(FDroidApp.this, WifiStateChangeService.class));
        }
    });
}

From source file:com.heliosdecompiler.helios.bootloader.Bootloader.java

private static byte[] loadSWTLibrary() throws IOException, NoSuchMethodException, IllegalAccessException,
        InvocationTargetException, ClassNotFoundException {
    String name = getOSName();/*from ww  w .j av a  2 s .c o  m*/
    if (name == null)
        throw new IllegalArgumentException("Cannot determine OS");
    String arch = getArch();
    if (arch == null)
        throw new IllegalArgumentException("Cannot determine architecture");

    String artifactId = "org.eclipse.swt." + name + "." + arch;
    String swtLocation = artifactId + "-" + SWT_VERSION + ".jar";

    System.out.println("Loading SWT version " + swtLocation);

    byte[] data = null;

    File savedJar = new File(Constants.DATA_DIR, swtLocation);
    if (savedJar.isDirectory() && !savedJar.delete())
        throw new IllegalArgumentException("Saved file is a directory and could not be deleted");

    if (savedJar.exists() && savedJar.canRead()) {
        try {
            System.out.println("Loading from saved file");
            InputStream inputStream = new FileInputStream(savedJar);
            ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
            copy(inputStream, outputStream);
            data = outputStream.toByteArray();
        } catch (IOException exception) {
            System.out.println("Failed to load from saved file.");
            exception.printStackTrace(System.out);
        }
    }
    if (data == null) {
        InputStream fromJar = Bootloader.class.getResourceAsStream("/swt/" + swtLocation);
        if (fromJar != null) {
            try {
                System.out.println("Loading from within JAR");
                ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
                copy(fromJar, outputStream);
                data = outputStream.toByteArray();
            } catch (IOException exception) {
                System.out.println("Failed to load within JAR");
                exception.printStackTrace(System.out);
            }
        }
    }
    if (data == null) {
        URL url = new URL("https://maven-eclipse.github.io/maven/org/eclipse/swt/" + artifactId + "/"
                + SWT_VERSION + "/" + swtLocation);
        try {
            System.out.println("Loading over the internet");
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            if (connection.getResponseCode() == 200) {
                InputStream fromURL = connection.getInputStream();
                ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
                copy(fromURL, outputStream);
                data = outputStream.toByteArray();
            } else {
                throw new IOException(connection.getResponseCode() + ": " + connection.getResponseMessage());
            }
        } catch (IOException exception) {
            System.out.println("Failed to load over the internet");
            exception.printStackTrace(System.out);
        }
    }

    if (data == null) {
        throw new IllegalArgumentException("Failed to load SWT");
    }

    if (!savedJar.exists()) {
        try {
            System.out.println("Writing to saved file");
            if (savedJar.createNewFile()) {
                FileOutputStream fileOutputStream = new FileOutputStream(savedJar);
                fileOutputStream.write(data);
                fileOutputStream.close();
            } else {
                throw new IOException("Could not create new file");
            }
        } catch (IOException exception) {
            System.out.println("Failed to write to saved file");
            exception.printStackTrace(System.out);
        }
    }

    byte[] dd = data;

    URL.setURLStreamHandlerFactory(protocol -> { //JarInJar!
        if (protocol.equals("swt")) {
            return new URLStreamHandler() {
                protected URLConnection openConnection(URL u) {
                    return new URLConnection(u) {
                        public void connect() {
                        }

                        public InputStream getInputStream() {
                            return new ByteArrayInputStream(dd);
                        }
                    };
                }

                protected void parseURL(URL u, String spec, int start, int limit) {
                    // Don't parse or it's too slow
                }
            };
        }
        return null;
    });

    ClassLoader classLoader = Bootloader.class.getClassLoader();
    Method method = URLClassLoader.class.getDeclaredMethod("addURL", URL.class);
    method.setAccessible(true);
    method.invoke(classLoader, new URL("swt://load"));

    return data;
}

From source file:net.rptools.maptool.client.MapTool.java

public static void main(String[] args) {
    if (MAC_OS_X) {
        // On OSX the menu bar at the top of the screen can be enabled at any time, but the
        // title (ie. name of the application) has to be set before the GUI is initialized (by
        // creating a frame, loading a splash screen, etc).  So we do it here.
        System.setProperty("apple.laf.useScreenMenuBar", "true");
        System.setProperty("com.apple.mrj.application.apple.menu.about.name", "About MapTool...");
        System.setProperty("apple.awt.brushMetalLook", "true");
    }/*from ww w  .  j  av  a  2 s  .c om*/
    // Before anything else, create a place to store all the data
    try {
        AppUtil.getAppHome();
    } catch (Throwable t) {
        t.printStackTrace();

        // Create an empty frame so there's something to click on if the dialog goes in the background
        JFrame frame = new JFrame();
        SwingUtil.centerOnScreen(frame);
        frame.setVisible(true);

        String errorCreatingDir = "Error creating data directory";
        log.error(errorCreatingDir, t);
        JOptionPane.showMessageDialog(frame, t.getMessage(), errorCreatingDir, JOptionPane.ERROR_MESSAGE);
        System.exit(1);
    }
    verifyJavaVersion();

    configureLogging();

    // System properties
    System.setProperty("swing.aatext", "true");
    // System.setProperty("sun.java2d.opengl", "true");

    final SplashScreen splash = new SplashScreen(SPLASH_IMAGE, getVersion());
    splash.showSplashScreen();

    // Protocol handlers
    // cp:// is registered by the RPTURLStreamHandlerFactory constructor (why?)
    RPTURLStreamHandlerFactory factory = new RPTURLStreamHandlerFactory();
    factory.registerProtocol("asset", new AssetURLStreamHandler());
    URL.setURLStreamHandlerFactory(factory);

    final Toolkit tk = Toolkit.getDefaultToolkit();
    tk.getSystemEventQueue().push(new MapToolEventQueue());

    // LAF
    try {
        // If we are running under Mac OS X then save native menu bar look & feel components
        // Note the order of creation for the AppMenuBar, this specific chronology
        // allows the system to set up system defaults before we go and modify things.
        // That is, please don't move these lines around unless you test the result on windows and mac
        String lafname;
        if (MAC_OS_X) {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            menuBar = new AppMenuBar();
            lafname = "net.rptools.maptool.client.TinyLookAndFeelMac";
            UIManager.setLookAndFeel(lafname);
            macOSXicon();
        }
        // If running on Windows based OS, CJK font is broken when using TinyLAF.
        //         else if (WINDOWS) {
        //            UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
        //            menuBar = new AppMenuBar();
        //         }
        else {
            lafname = "de.muntjak.tinylookandfeel.TinyLookAndFeel";
            UIManager.setLookAndFeel(lafname);
            menuBar = new AppMenuBar();
        }
        // After the TinyLAF library is initialized, look to see if there is a Default.theme
        // in our AppHome directory and load it if there is.  Unfortunately, changing the
        // search path for the default theme requires subclassing TinyLAF and because
        // we have both the original and a Mac version that gets cumbersome.  (Really
        // the Mac version should use the default and then install the keystroke differences
        // but what we have works and I'm loathe to go playing with it at 1.3b87 -- yes, 87!)
        File f = AppUtil.getAppHome("config");
        if (f.exists()) {
            File f2 = new File(f, "Default.theme");
            if (f2.exists()) {
                if (Theme.loadTheme(f2)) {
                    // re-install the Tiny Look and Feel
                    UIManager.setLookAndFeel(lafname);

                    // Update the ComponentUIs for all Components. This
                    // needs to be invoked for all windows.
                    //SwingUtilities.updateComponentTreeUI(rootComponent);
                }
            }
        }

        com.jidesoft.utils.Lm.verifyLicense("Trevor Croft", "rptools", "5MfIVe:WXJBDrToeLWPhMv3kI2s3VFo");
        LookAndFeelFactory.addUIDefaultsCustomizer(new LookAndFeelFactory.UIDefaultsCustomizer() {
            public void customize(UIDefaults defaults) {
                // Remove red border around menus
                defaults.put("PopupMenu.foreground", Color.lightGray);
            }
        });
        LookAndFeelFactory.installJideExtension(LookAndFeelFactory.XERTO_STYLE);

        /****************************************************************************
         * For TinyLAF 1.3.04 this is how the color was changed for a
         * button.
         */
        // Theme.buttonPressedColor[Theme.style] = new ColorReference(Color.gray);

        /****************************************************************************
         * And this is how it's done in TinyLAF 1.4.0 (no idea about the
         * intervening versions).
         */
        Theme.buttonPressedColor = new SBReference(Color.GRAY, 0, -6, SBReference.SUB3_COLOR);

        configureJide();
    } catch (Exception e) {
        MapTool.showError("msg.error.lafSetup", e);
        System.exit(1);
    }

    /**
     * This is a tweak that makes the Chinese version work better.
     * <p>
     * Consider reviewing <a
     * href="http://en.wikipedia.org/wiki/CJK_characters"
     * >http://en.wikipedia.org/wiki/CJK_characters</a> before making
     * changes. And http://www.scarfboy.com/coding/unicode-tool is also a
     * really cool site.
     */
    if (Locale.CHINA.equals(Locale.getDefault())) {
        // The following font name appears to be "Sim Sun".  It can be downloaded
        // from here:  http://fr.cooltext.com/Fonts-Unicode-Chinese
        Font f = new Font("\u65B0\u5B8B\u4F53", Font.PLAIN, 12);
        FontUIResource fontRes = new FontUIResource(f);
        for (Enumeration<Object> keys = UIManager.getDefaults().keys(); keys.hasMoreElements();) {
            Object key = keys.nextElement();
            Object value = UIManager.get(key);
            if (value instanceof FontUIResource)
                UIManager.put(key, fontRes);
        }
    }

    // Draw frame contents on resize
    tk.setDynamicLayout(true);

    EventQueue.invokeLater(new Runnable() {
        public void run() {
            initialize();
            EventQueue.invokeLater(new Runnable() {
                public void run() {
                    clientFrame.setVisible(true);
                    splash.hideSplashScreen();
                    EventQueue.invokeLater(new Runnable() {
                        public void run() {
                            postInitialize();
                        }
                    });
                }
            });
        }
    });
    // new Thread(new HeapSpy()).start();
}