Code example for SocketPermission

        try { 
            SocketPermission p0= new SocketPermission("","connect");
            PermissionCollection pc = p0.newPermissionCollection();
            pc.setReadOnly();   // this should lock out future adds
            SocketPermission p1= new SocketPermission("","connect");
            throw new 
                Exception("Failed...SocketPermission added to readonly SocketPermissionCollection.");
        } catch (SecurityException se) {
            System.out.println("SocketPermissionCollection passed");
    static void tryFilePC() throws Exception { 
        try { 
            FilePermission p0 = new FilePermission("/home/foobar","read");
            PermissionCollection pc = p0.newPermissionCollection();
Connect your IDE to all the code out there  Get Codota for Java