Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.IOException;
- import java.io.InputStream;
- import java.net.Socket;
- import java.security.NoSuchAlgorithmException;
- import javax.net.ssl.SSLContext;
- import javax.net.ssl.SSLEngine;
- public class Test {
- public static void main(String[] args) throws NoSuchAlgorithmException, Exception {
- Socket s = SSLContext.getDefault().getSocketFactory().createSocket("google.com", 443);
- s.getOutputStream().write("GET / HTTP/1.0\r\n\r\n".getBytes());
- InputStream inputStream = s.getInputStream();
- int c;
- while ((c = inputStream.read()) > -1) {
- System.out.print((char)c);
- if (c<=13)
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement