import java.io.*; import java.net.ServerSocket; import java.net.Socket; import java.util.zip.GZIPInputStream; import java.util.zip.GZIPOutputStream; import javax.net.ssl.*; public class HelloServerSSL { public static void main(String[] args) { try { ServerSocket serverSocket = new ServerSocket(8686, 5); Socket ins = serverSocket.accept(); Thread t1 = new Lecture(ins); Thread t = new Ecriture(ins); int i = 0; while (i++ != 5) { t1.start(); t.start(); } } catch (Exception e) { e.printStackTrace(); } } } class Lecture extends Thread implements Runnable { Socket sock = null; GZIPInputStream gis = null; ObjectInputStream ois = null; public Lecture(Socket s) { sock = s; GZIPInputStream gis; try { gis = new GZIPInputStream(sock.getInputStream()); ois = new ObjectInputStream(new BufferedInputStream(gis, 48000)); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public void run() { try { System.out.println((String) ois.readObject()); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } } class Ecriture extends Thread implements Runnable { Socket sock = null; GZIPOutputStream gos = null; ObjectOutputStream oos = null; public Ecriture(Socket s) { sock = s; try { gos = new GZIPOutputStream(sock.getOutputStream()); oos = new ObjectOutputStream(new BufferedOutputStream(gos, 48000)); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public void run() { try { oos.writeObject(new String("salut")); oos.flush(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }