< prev index next >

test/sun/security/ssl/ServerHandshaker/GetPeerHostClient.java

Print this page




  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /**
  25  *
  26  * Test for bug 4302026
  27  * Summary: make sure the server side doesn't do DNS lookup.
  28  * The client just sends a request to the server.
  29  */
  30 
  31 import java.net.*;
  32 import java.io.*;
  33 import javax.net.ssl.*;
  34 import com.sun.net.ssl.*;
  35 
  36 class GetPeerHostClient extends Thread
  37 {
  38     SSLSocket s;
  39     String server;
  40 
  41     public GetPeerHostClient (int serverPort)
  42     {
  43         try {
  44             SSLSocketFactory factory = (SSLSocketFactory)SSLSocketFactory
  45                                         .getDefault();
  46             server = InetAddress.getLocalHost().getHostName();
  47             s = (SSLSocket) factory.createSocket(server, serverPort);
  48             System.out.println("CLIENT: connected to the server- " + server);
  49         } catch (Exception e) {
  50                 System.err.println("Unexpected exceptions: " + e);
  51                 e.printStackTrace();
  52           }
  53     }
  54 




  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /**
  25  *
  26  * Test for bug 4302026
  27  * Summary: make sure the server side doesn't do DNS lookup.
  28  * The client just sends a request to the server.
  29  */
  30 
  31 import java.net.*;
  32 import java.io.*;
  33 import javax.net.ssl.*;

  34 
  35 class GetPeerHostClient extends Thread
  36 {
  37     SSLSocket s;
  38     String server;
  39 
  40     public GetPeerHostClient (int serverPort)
  41     {
  42         try {
  43             SSLSocketFactory factory = (SSLSocketFactory)SSLSocketFactory
  44                                         .getDefault();
  45             server = InetAddress.getLocalHost().getHostName();
  46             s = (SSLSocket) factory.createSocket(server, serverPort);
  47             System.out.println("CLIENT: connected to the server- " + server);
  48         } catch (Exception e) {
  49                 System.err.println("Unexpected exceptions: " + e);
  50                 e.printStackTrace();
  51           }
  52     }
  53 


< prev index next >