FileDocCategorySizeDatePackage
SSLTest.javaAPI DocAndroid 1.5 API1690Wed May 06 22:42:02 BST 2009com.android.unit_tests

SSLTest

public class SSLTest extends TestCase

Fields Summary
Constructors Summary
Methods Summary
public voidtestCertificate()

        // test www.fortify.net/sslcheck.html
        Socket ssl = SSLCertificateSocketFactory.getDefault().createSocket("www.fortify.net",443);
        assertNotNull(ssl);

        OutputStream out = ssl.getOutputStream();
        assertNotNull(out);

        InputStream in = ssl.getInputStream();
        assertNotNull(in);

        String get = "GET /sslcheck.html HTTP/1.1\r\nHost: 68.178.217.222\r\n\r\n";

        // System.out.println("going for write...");
        out.write(get.getBytes());

        byte[] b = new byte[1024];
        // System.out.println("going for read...");
        int ret = in.read(b);

        // System.out.println(new String(b));