@Test
public void postMessage() throws IOException {

    try {
        String format = "raw";
        int frequency = 38;
        int[] data = new int[]{18031, 8755, 1190, 1190, 1190, 3341, 1190, 3341, 1190, 3341, 1190, 1190, 1190, 3341, 1190, 3341, 1190, 3341, 1190, 3341, 1190, 3341, 1190, 3341, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 3341, 1190, 3341, 1190, 1190, 1190, 3341, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 3341, 1190, 3341, 1190, 3341, 1190, 3341, 1190, 3341, 1190, 65535, 0, 9379, 18031, 4400, 1190};
        Message message = new Message(format, frequency, data);
        LocalIRKit.postMessage(null, message, new HttpClient());
        fail("IllegalArgumentException is not thrown");
    } catch (IllegalArgumentException e) {
        // OK
    }
    try {
        LocalIRKit.postMessage(mInetAddress, null, new HttpClient());
        fail("IllegalArgumentException is not thrown");
    } catch (IllegalArgumentException e) {
        // OK
    }
    try {
        String format = "raw";
        int frequency = 38;
        int[] data = new int[]{18031, 8755, 1190, 1190, 1190, 3341, 1190, 3341, 1190, 3341, 1190, 1190, 1190, 3341, 1190, 3341, 1190, 3341, 1190, 3341, 1190, 3341, 1190, 3341, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 3341, 1190, 3341, 1190, 1190, 1190, 3341, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 3341, 1190, 3341, 1190, 3341, 1190, 3341, 1190, 3341, 1190, 65535, 0, 9379, 18031, 4400, 1190};
        Message message = new Message(format, frequency, data);
        LocalIRKit.postMessage(mInetAddress, message, null);
        fail("IllegalArgumentException is not thrown");
    } catch (IllegalArgumentException e) {
        // OK
    }
    {
        HttpClient httpClient = mock(HttpClient.class);
        HttpResponse httpResponse = mock(HttpResponse.class);
        when(httpResponse.getStatusCode()).thenReturn(200);
        when(httpClient.request(Mockito.notNull(HttpRequest.class))).thenReturn(httpResponse);
        String format = "raw";
        int frequency = 38;
        int[] data = new int[]{18031, 8755, 1190, 1190, 1190, 3341, 1190, 3341, 1190, 3341, 1190, 1190, 1190, 3341, 1190, 3341, 1190, 3341, 1190, 3341, 1190, 3341, 1190, 3341, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 3341, 1190, 3341, 1190, 1190, 1190, 3341, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 3341, 1190, 3341, 1190, 3341, 1190, 3341, 1190, 3341, 1190, 65535, 0, 9379, 18031, 4400, 1190};
        Message message = new Message(format, frequency, data);
        LocalIRKit.postMessage(mInetAddress, message, httpClient);
    }
    {
        HttpClient httpClient = mock(HttpClient.class);
        HttpResponse httpResponse = mock(HttpResponse.class);
        when(httpResponse.getStatusCode()).thenReturn(200);
        when(httpClient.request(Mockito.notNull(HttpRequest.class))).thenReturn(httpResponse);
        String format = "raw";
        int frequency = 38;
        int[] data = new int[]{18031, 8755, 1190, 1190, 1190, 3341, 1190, 3341, 1190, 3341, 1190, 1190, 1190, 3341, 1190, 3341, 1190, 3341, 1190, 3341, 1190, 3341, 1190, 3341, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 3341, 1190, 3341, 1190, 1190, 1190, 3341, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 1190, 3341, 1190, 3341, 1190, 3341, 1190, 3341, 1190, 3341, 1190, 65535, 0, 9379, 18031, 4400, 1190};
        LocalIRKit.postMessage(mInetAddress, format, frequency, data, httpClient);
    }
}