MainClass.java Source code

Java tutorial

Introduction

Here is the source code for MainClass.java

Source

import java.io.*;
import java.net.*;
import javax.net.ssl.*;

public class MainClass {

    private static final int PORT = 8080;

    public static void main(String[] args) throws Exception {

        SSLServerSocketFactory ssf = (SSLServerSocketFactory) SSLServerSocketFactory.getDefault();
        ServerSocket ss = ssf.createServerSocket(PORT);
        Socket s = ss.accept();
        BufferedReader in = new BufferedReader(new InputStreamReader(s.getInputStream()));
        String line = null;
        while (((line = in.readLine()) != null)) {
            System.out.println(line);
        }
        in.close();
        s.close();
    }
}