Package cleancoderscom.socketserver

Examples of cleancoderscom.socketserver.SocketServer


  public class WithClosingSocketService {
    @Before
    public void setUp() throws Exception {
      service = new ClosingSocketService();
      server = new SocketServer(port, service);
    }
View Full Code Here


public class Main {

  public static void main(String[] args) throws Exception {
    TestSetup.setupContext();
    SocketServer server = new SocketServer(8080, s -> {
      try {
        String frontPage = getFrontPage();
        String response = makeResponse(frontPage);
        s.getOutputStream().write(response.getBytes());
      } catch(IOException e) {
        e.printStackTrace();
      }
    });
    server.start();
  }
View Full Code Here

import java.io.OutputStream;
import java.net.Socket;

public class HelloWorld implements SocketService {
  public static void main(String[] args) throws Exception {
    SocketServer server = new SocketServer(8080, new HelloWorld());
    server.start();
  }
View Full Code Here

    private ReadingSocketService readingService;

    @Before
    public void setup() throws Exception {
      readingService = new ReadingSocketService();
      server = new SocketServer(port, readingService);
    }
View Full Code Here

    private EchoSocketService echoService;

    @Before
    public void setup() throws Exception {
      echoService = new EchoSocketService();
      server = new SocketServer(port, echoService);
    }
View Full Code Here

TOP

Related Classes of cleancoderscom.socketserver.SocketServer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.