Search in sources :

Example 21 with Runnable

use of com.github.dreamhead.moco.Runnable in project moco by dreamhead.

the class ActualSocketServerTest method should_merge_socket_servers_with_second_port.

@Test
public void should_merge_socket_servers_with_second_port() throws Exception {
    SocketServer server = socketServer();
    SocketServer secondServer = socketServer(12307);
    final SocketServer newServer = ((ActualSocketServer) server).mergeServer((ActualSocketServer) secondServer);
    running(newServer, new Runnable() {

        @Override
        public void run() throws Exception {
            assertThat(newServer.port(), is(12307));
        }
    });
}
Also used : SocketServer(com.github.dreamhead.moco.SocketServer) Runnable(com.github.dreamhead.moco.Runnable) Test(org.junit.Test)

Aggregations

Runnable (com.github.dreamhead.moco.Runnable)21 Test (org.junit.Test)21 HttpServer (com.github.dreamhead.moco.HttpServer)16 IOException (java.io.IOException)16 AbstractMocoHttpTest (com.github.dreamhead.moco.AbstractMocoHttpTest)15 HttpResponseException (org.apache.http.client.HttpResponseException)11 SocketServer (com.github.dreamhead.moco.SocketServer)3 Request (us.codecraft.webmagic.Request)3 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 Response (org.apache.http.client.fluent.Response)2 CloseableHttpResponse (org.apache.http.client.methods.CloseableHttpResponse)1 RequestBuilder (org.apache.http.client.methods.RequestBuilder)1 CloseableHttpClient (org.apache.http.impl.client.CloseableHttpClient)1 Page (us.codecraft.webmagic.Page)1 Site (us.codecraft.webmagic.Site)1