Search in sources :

Example 1 with ClientRequestHandler

use of ClientServerCommunication.ClientRequestHandler in project SmartCity-Market by TechnionYP5777.

the class ClientRequestHandlerTest method ClientRequestHandlerUnknownHostTest.

@Test
public void ClientRequestHandlerUnknownHostTest() {
    try {
        ClientRequestHandler clientRequestHandler = new ClientRequestHandler();
        clientRequestHandler.createSocket(portTest, SERVER_UKNOWN_HOST_NAME, TIMEOUT);
        clientRequestHandler.finishRequest();
    } catch (UnknownHostException e) {
    /* success */
    } catch (RuntimeException e) {
        fail();
    }
}
Also used : UnknownHostException(java.net.UnknownHostException) ClientRequestHandler(ClientServerCommunication.ClientRequestHandler) Test(org.junit.Test)

Example 2 with ClientRequestHandler

use of ClientServerCommunication.ClientRequestHandler in project SmartCity-Market by TechnionYP5777.

the class ClientRequestHandlerTest method ClientRequestHandlerLegalTimeoutTest.

@Test
public void ClientRequestHandlerLegalTimeoutTest() {
    new Thread(new ServerTest()).start();
    try {
        Thread.sleep(100);
    } catch (InterruptedException e1) {
        fail();
    }
    try {
        ClientRequestHandler clientRequestHandler = new ClientRequestHandler();
        clientRequestHandler.createSocket(portTest, SERVER_HOST_NAME, TIMEOUT);
        clientRequestHandler.finishRequest();
    } catch (UnknownHostException | RuntimeException e) {
        fail();
    }
}
Also used : UnknownHostException(java.net.UnknownHostException) ClientRequestHandler(ClientServerCommunication.ClientRequestHandler) Test(org.junit.Test)

Aggregations

ClientRequestHandler (ClientServerCommunication.ClientRequestHandler)2 UnknownHostException (java.net.UnknownHostException)2 Test (org.junit.Test)2