Java 8 NetPermission - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 NetPermission class.

This code example shows how to use the following methods:getActions
import junit.framework.TestCase; 
 
public class OldNetPermissionTest extends TestCase {
 
    public void test_ConstructorLjava_lang_StringLjava_lang_String() { 
        NetPermission n1 = new NetPermission("requestPasswordAuthentication", "");
        assertEquals("", n1.getActions());
    } 
} 
6
CodeRank
This code example shows how to use the following methods:
            }; 
 
    private static final Permission[] basicp = new Permission[] { 
        new NetPermission("setDefaultAuthenticator"), 
            new NetPermission("requestPasswordAuthentication"), 
            new NetPermission("specifyStreamHandler") 
            }; 
 
    private static final Permission[] delegatep = new Permission[] { 
        new DelegationPermission( 
            "\"host/foo.example.com@EXAMPLE.COM\" \"cn=John,o=imc,c=us\""), 
        new DelegationPermission( 
            "\"user/rosanna@EXAMPLE.COM\" \"cn=John,o=imc,c=us\""), 
        new DelegationPermission( 
            "\"host/bar.example.com@EXAMPLE.COM\" \"cn=John,o=imc,c=us\"") 
            }; 
 
    private static final Permission[] servicep = new Permission[]{ 
        new ServicePermission("krbtgt/EXAMPLE.COM@EXAMPLE.COM", "initiate"), 
        new ServicePermission("ldap/EXAMPLE.COM@EXAMPLE.COM", "initiate"), 
5
CodeRank
This code example shows how to use the following methods:getName
	/** 
	 * @tests java.net.NetPermission#NetPermission(java.lang.String) 
	 */ 
	public void test_ConstructorLjava_lang_String() { 
		// Test for method java.net.NetPermission(java.lang.String) 
		NetPermission n = new NetPermission("requestPasswordAuthentication");
		assertEquals("Returned incorrect name", 
				"requestPasswordAuthentication", n.getName());
	} 
 
	/** 
	 * @tests java.net.NetPermission#NetPermission(java.lang.String, 
	 *        java.lang.String) 
	 */ 
	public void test_ConstructorLjava_lang_StringLjava_lang_String() { 
		// Test for method java.net.NetPermission(java.lang.String, 
		// java.lang.String) 
		NetPermission n = new NetPermission("requestPasswordAuthentication",
				null); 
		assertEquals("Returned incorrect name", 
5
CodeRank
This code example shows how to use the following methods:getActions
import junit.framework.TestCase; 
 
public class OldNetPermissionTest extends TestCase {
 
    public void test_ConstructorLjava_lang_StringLjava_lang_String() { 
        NetPermission n1 = new NetPermission("requestPasswordAuthentication", "");
        assertEquals("", n1.getActions());
    } 
} 
5
CodeRank
This code example shows how to use the following methods:
        sm.addPermission(source, new PropertyPermission("javax.xml.datatype.DatatypeFactory", "read"));
        sm.addPermission(source, new PropertyPermission("jaxp.debug", "read"));
        sm.addPermission(source, new PropertyPermission("sun.boot.class.path", "read"));
        sm.addPermission(source, new PropertyPermission("sun.timezone.ids.oldmapping", "read"));
        sm.addPermission(source, new ReflectPermission("suppressAccessChecks"));
        sm.addPermission(source, new NetPermission("specifyStreamHandler"));
        sm.setReadOnly();
        System.setSecurityManager(sm);
 
        // uses implicit Sun14ReflectionProvider in JDK >= 1.4, since it has the appropriate 
        // rights 
        xstream = new XStream();
 
        assertBothWays(); 
    } 
 
    public void testSerializeWithXppDriverAndPureJavaReflectionProviderAndActiveSecurityManager() { 
        sm.addPermission(source, new RuntimePermission("accessDeclaredMembers"));
        sm.addPermission(source, new RuntimePermission("createClassLoader"));
        sm.addPermission(source, new RuntimePermission("modifyThreadGroup"));
4
CodeRank
This code example shows how to use the following methods:
            }; 
 
    private static final Permission[] basicp = new Permission[] { 
        new NetPermission("setDefaultAuthenticator"), 
            new NetPermission("requestPasswordAuthentication"), 
            new NetPermission("specifyStreamHandler") 
            }; 
 
    private static final Permission[] delegatep = new Permission[] { 
        new DelegationPermission( 
            "\"host/foo.example.com@EXAMPLE.COM\" \"cn=John,o=imc,c=us\""), 
        new DelegationPermission( 
            "\"user/rosanna@EXAMPLE.COM\" \"cn=John,o=imc,c=us\""), 
        new DelegationPermission( 
            "\"host/bar.example.com@EXAMPLE.COM\" \"cn=John,o=imc,c=us\"") 
            }; 
 
    private static final Permission[] servicep = new Permission[]{ 
        new ServicePermission("krbtgt/EXAMPLE.COM@EXAMPLE.COM", "initiate"), 
        new ServicePermission("ldap/EXAMPLE.COM@EXAMPLE.COM", "initiate"), 
4
CodeRank
See Code Examples for Java 8 NetPermission Methods: