FileDocCategorySizeDatePackage
mySSLSession.javaAPI DocAndroid 1.5 API5012Wed May 06 22:41:06 BST 2009org.apache.harmony.xnet.tests.support

mySSLSession

public class mySSLSession extends Object implements SSLSession

Fields Summary
private byte[]
idData
private String
nameHost
private int
namePort
private Hashtable
table
private boolean
invalidateDone
private Certificate[]
certs
private X509Certificate[]
xCerts
Constructors Summary
public mySSLSession(String host, int port, byte[] id)

    
           
        certs = null;
        xCerts = null;
        nameHost = host;
        namePort = port;
        idData = id;
        table = new Hashtable();            
    
public mySSLSession(X509Certificate[] xc)

        certs = TestCertUtils.getCertChain();
        xCerts = xc;
    
public mySSLSession(Certificate[] xc)

        certs = xc;
        xCerts = new X509Certificate[xc.length];
        int i = 0;
        for (Certificate cert : xc) {
            xCerts[i++] = X509Certificate.getInstance(cert.getEncoded());
        }
    
public mySSLSession()

    
Methods Summary
public intgetApplicationBufferSize()

        return 1234567;
    
public java.lang.StringgetCipherSuite()

        return "SuiteName";
    
public longgetCreationTime()

        return 1000l;
    
public byte[]getId()

        return idData;
    
public longgetLastAccessedTime()

        return 2000l;
    
public java.security.cert.Certificate[]getLocalCertificates()

        return null;
    
public java.security.PrincipalgetLocalPrincipal()

        return null;
    
public intgetPacketBufferSize()

        return 12345;
    
public javax.security.cert.X509Certificate[]getPeerCertificateChain()

        if(xCerts == null) {
            throw new SSLPeerUnverifiedException("peer not authenticated");
        } else {
            return xCerts;
        }
    
public java.security.cert.Certificate[]getPeerCertificates()

        if (certs == null) {
            throw new SSLPeerUnverifiedException("peer not authenticated");
        } else {
            return certs;
        }
    
public java.lang.StringgetPeerHost()

        return nameHost;
    
public intgetPeerPort()

        return namePort;
    
public java.security.PrincipalgetPeerPrincipal()

        return null;
    
public java.lang.StringgetProtocol()

        return "ProtocolName";
    
public javax.net.ssl.SSLSessionContextgetSessionContext()

        return null;
    
public java.lang.ObjectgetValue(java.lang.String s)

        if(s == null) {
            throw new IllegalArgumentException("argument can not be null");
        } else {
            return table.get(s);
        }
    
public java.lang.String[]getValueNames()

        Vector vector = new Vector();
        Enumeration enumeration = table.keys();
        while (enumeration.hasMoreElements()) {
            vector.addElement(enumeration.nextElement());
        }
        String as[] = new String[vector.size()];
        vector.copyInto(as);
        return as;
    
public voidinvalidate()

        invalidateDone = true;
    
public booleanisValid()

        return invalidateDone;
    
public voidputValue(java.lang.String s, java.lang.Object obj)

        if(s == null || obj == null)
            throw new IllegalArgumentException("arguments can not be null");
        Object obj1 = table.put(s, obj);
        if(obj1 instanceof SSLSessionBindingListener) {
            SSLSessionBindingEvent sslsessionbindingevent = new SSLSessionBindingEvent(this, s);
            ((SSLSessionBindingListener)obj1).valueUnbound(sslsessionbindingevent);
        }
        if(obj instanceof SSLSessionBindingListener) {
            SSLSessionBindingEvent sslsessionbindingevent1 = new SSLSessionBindingEvent(this, s);
            ((SSLSessionBindingListener)obj).valueBound(sslsessionbindingevent1);
        }
    
public voidremoveValue(java.lang.String s)

        if(s == null)
            throw new IllegalArgumentException("argument can not be null");
        Object obj = table.remove(s);
        if(obj instanceof SSLSessionBindingListener) {
            SSLSessionBindingEvent sslsessionbindingevent = new SSLSessionBindingEvent(this, s);
            ((SSLSessionBindingListener)obj).valueUnbound(sslsessionbindingevent);
        }