Permalink
Browse files

Testing out resolving of t.co redirects

  • Loading branch information...
morphex committed Apr 1, 2018
1 parent e57ae88 commit 3341f7780bb5d5e2cd90d0a25bb61203a0072147
Showing with 26 additions and 0 deletions.
  1. +26 −0 src/main/java/org/morphex/app/ResolveRedirect.java
@@ -0,0 +1,26 @@
import javax.net.ssl.*;
import java.io.*;
public class ResolveRedirect {
public static void main(String[] args) throws Exception {
SSLSocketFactory factory = (SSLSocketFactory)SSLSocketFactory.getDefault();
SSLSocket socket = (SSLSocket)factory.createSocket("t.co", 443);
socket.startHandshake();
PrintWriter send = new PrintWriter(new BufferedWriter(
new OutputStreamWriter(socket.getOutputStream())));
send.println("GET /TQuFITDB4r HTTP/1.0");
send.println("Host: t.co:443");
send.println();
send.flush();
BufferedReader receive = new BufferedReader(
new InputStreamReader(socket.getInputStream()));
String line = "";
do {
System.out.println(line);
line = receive.readLine();
} while (line != null);
send.close();
receive.close();
socket.close();
}
}

0 comments on commit 3341f77

Please sign in to comment.