@@ -0,0 +1,1776 @@
+package org.lantern;%0A%0Aimport java.io.IOException;%0Aimport java.io.InputStream;%0Aimport java.io.OutputStream;%0Aimport java.net.InetSocketAddress;%0A%0Aimport javax.net.ssl.SSLSocket;%0Aimport javax.net.ssl.SSLSocketFactory;%0A%0Aimport org.apache.commons.io.IOUtils;%0A%0Aimport com.google.common.base.Charsets;%0A%0Apublic class HostSpoofingTest %7B%0A%0A    public static void main(final String... args) throws Exception %7B%0A        final SSLSocket sock = (SSLSocket) SSLSocketFactory.getDefault().createSocket();%0A        sock.connect(new InetSocketAddress(%22www.google.com%22, 443), 10000);%0A        %0A        OutputStream os = null;%0A        try %7B%0A            os = sock.getOutputStream();%0A            writeHttpRequest(os);%0A            readResponse(sock.getInputStream());%0A        %7D finally %7B%0A            IOUtils.closeQuietly(os);%0A        %7D%0A    %7D%0A%0A    private static void readResponse(InputStream inputStream) throws IOException %7B%0A        /*%0A        BufferedReader br = null;%0A        br = new BufferedReader(new InputStreamReader(inputStream));%0A        String cur = br.readLine();%0A        while (!StringUtils.isEmpty(cur)) %7B%0A            System.err.println(cur);%0A            cur = br.readLine();%0A        %7D%0A        */%0A        final byte%5B%5D body = new byte%5B1200%5D;%0A        inputStream.read(body);%0A        System.err.println(new String(body, %22UTF-8%22));%0A    %7D%0A%0A    private static void writeHttpRequest(final OutputStream os) throws IOException %7B%0A        os.write(%22GET / HTTP/1.1%5Cr%5Cn%22.getBytes(Charsets.UTF_8));%0A        //os.write(%22Host: lantern-compute-engine-test.c.o59bxf5.internal%5Cr%5Cn%22.getBytes(Charsets.UTF_8));%0A        //os.write(%22Host: 23.236.59.9%5Cr%5Cn%22.getBytes(Charsets.UTF_8));%0A        os.write(%22Host: 10.240.200.99%5Cr%5Cn%22.getBytes(Charsets.UTF_8));%0A        os.write(%22%5Cr%5Cn%22.getBytes(Charsets.UTF_8));%0A    %7D%0A%0A%7D%0A

Test for host spoofing on different sites