Read through this it should help:
http://stackoverflow.com/questions/995514/https-connection-android
On Friday, April 12, 2013 7:52:14 AM UTC-5, Alan wrote:
>
> I am a relative novice at Android and have had issues getting a simple SSL
> connection working to a java server.
>
> I know the java server works as I tested it using the same keystore as the
> server and a java client.
>
> The Android client does send something as the java server accepts a
> connection and displays a null value for the variable 'temp', and no error
> message.
>
> Android Client:
>
> try{
>
> String error = "test";
> sslsocketfactory = (SSLSocketFactory) SSLSocketFactory.getDefault();
> s = (SSLSocket) sslsocketfactory.createSocket("192.168.2.101", port);
>
> outStream = s.getOutputStream();
> outStreamWriter = new OutputStreamWriter(outStream);
> bufferedWriter = new BufferedWriter(outStreamWriter);
>
> bufferedWriter.write(error + "\n");
> bufferedWriter.flush();
>
> } //end try
> catch (UnknownHostException e) {e.printStackTrace();}
> catch (IOException e) {e.printStackTrace();}
>
> finally{
> if (s != null){
> try {s.close();}
> catch (IOException e) {e.printStackTrace();}
> }
> }//end finally
> }
>
> I have not specified a truststore as i am unsure of how the mechanism
> works or how to implement this, and think this is probably the issue.
>
--
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.