package net.zephyrizing.http_server_test;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.net.SocketAddress;

import net.zephyrizing.http_server.HttpServerSocket;
import net.zephyrizing.http_server.HttpServerSocketImpl;

import org.junit.Test;

import static org.junit.Assert.*;

public class HttpServerSocketImplTest {

    public class TestServerSocket extends ServerSocket {
        public TestServerSocket() throws IOException {
            super();
        }

        int port;

        @Override
        public void bind(SocketAddress sockAddr) {
            InetSocketAddress iSockAddr = (InetSocketAddress)sockAddr;
            port = iSockAddr.getPort();
        }

        public int bindCalledWith() {
            return port;
        }
    }

    @Test
    public void testBindSocket() throws Exception {
        TestServerSocket testServerSocket = new TestServerSocket();
        HttpServerSocket socket = new HttpServerSocketImpl(testServerSocket);
        int port = 1000;
        socket.bind(port);
        assertEquals(port, testServerSocket.bindCalledWith());
    }
}

@@ -161,16 +161,64 @@
 dress;%0A%0A
+import net.zephyrizing.http_server.HttpRequest;%0A
 import n
@@ -320,16 +320,41 @@
 tImpl;%0A%0A
+import org.junit.Ignore;%0A
 import o
@@ -1110,16 +1110,17 @@
 t = 1000
+0
 ;%0A      
@@ -1208,11 +1208,347 @@
 );%0A    %7D
+%0A%0A    @Ignore%0A    @Test%0A    public void testSocketAccept() throws Exception %7B%0A        TestServerSocket testServerSocket = new TestServerSocket();%0A        HttpServerSocket socket = new HttpServerSocketImpl(testServerSocket);%0A        socket.bind(10000);%0A        HttpRequest request = socket.accept();%0A        assertNotNull(request);%0A    %7D
 %0A%7D%0A

Add a test to motivate the development of the HttpServerSocketImpl