I have a simple code for setting up a https connection to google and printing the response obtained.
import java.io.OutputStreamWriter; import java.net.URL;
You should not try to write into stream when you are performing HTTP GET. You should read from input stream instead:
BufferedReader reader = new BufferedReader(new InputStreamReader(con.getInputStream())); String line = null; while((line = reader.readLine()) != null) { //........ }