FileDocCategorySizeDatePackage
MockSecurityManager.javaAPI DocAndroid 1.5 API1665Wed May 06 22:41:04 BST 2009org.apache.harmony.nio.tests.java.nio.channels

MockSecurityManager

public class MockSecurityManager extends SecurityManager

Fields Summary
String
validHost
int
validPort
public boolean
checkAcceptCalled
public boolean
checkConnectCalled
Constructors Summary
MockSecurityManager()


     
        super();
        this.validHost = null;
    
MockSecurityManager(String host)

        super();
        this.validHost = host;
    
MockSecurityManager(int port)

        super();
        this.validPort = port;
    
Methods Summary
public voidcheckAccept(java.lang.String host, int port)

        checkAcceptCalled = true;
        // our local addr is OK.
        if (null != this.validHost) {
            if (!this.validHost.equals(host)) {
                throw new SecurityException();
            }
        }
        if (-1 != this.validPort) {
            if (this.validPort != port) {
                throw new SecurityException();
            }
        }
        if ("127.0.0.1".equals(host)) {
            return;
        }
        super.checkAccept(host, port);
    
public voidcheckConnect(java.lang.String host, int port)

        checkConnectCalled = true;
        // our local addr is OK.
        if (null != this.validHost) {
            if (!this.validHost.equals(host)) {
                throw new SecurityException();
            }
        }
        if ("127.0.0.1".equals(host)) {
            return;
        }
        super.checkConnect(host, port);
    
public voidcheckPermission(java.security.Permission perm)

        // no-op
    
public voidcheckPermission(java.security.Permission perm, java.lang.Object context)

        // no-op