Android SSL HttpGet (No peer certificate) error OR (Connection closed by peer) error

The following source should fix your problem. import android.app.Activity; import android.widget.EditText; import android.os.Bundle; import org.apache.http.HttpResponse; import org.apache.http.Header import java.io.InputStream; import java.io.BufferedReader; import java.io.InputStreamReader; import android.util.Log; import android.view.Menu; public class MainActivity extends Activity { private EditText text; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); text = (EditText) findViewById(R.id.editText1); connect(); } private void connect(){ try { … Read more

Java NoSuchAlgorithmException – SunJSSE, sun.security.ssl.SSLContextImpl$DefaultSSLContext

Well after doing some more searching I discovered the error may be related to other issues as invalid keystores, passwords etc. I then remembered that I had set two VM arguments for when I was testing SSL for my network connectivity. I removed the following VM arguments to fix the problem: -Djavax.net.ssl.keyStore=mySrvKeystore -Djavax.net.ssl.keyStorePassword=123456 Note: this … Read more

C# unsupported grant type when calling web api

The default implementation of OAuthAuthorizationServerHandler only accepts form encoding (i.e. application/x-www-form-urlencoded) and not JSON encoding (application/JSON). Your request’s ContentType should be application/x-www-form-urlencoded and pass the data in the body as: grant_type=password&username=Alice&password=password123 i.e. not in JSON format. The chrome example above works because it is not passing data as JSON. You only need this for getting … Read more

Android HTTP Get

Android is probably executing your request just fine. You just seem to be ignoring the data returned by the server. You could do something like this, for instance: public void changText(View view) { TextView textv = (TextView)findViewById(R.id.textview1); textv.setText(“Text Has Been Changed”); BufferedReader in = null; String data = null; try{ HttpClient httpclient = new DefaultHttpClient(); … Read more