/**
   * Ensure that if chunked transfer encoding is used, and there is a pause in the middle of
   * transmission, the whole message is still read
   */
  @Test
  public void testSendMessageWithChunkedResponseAndPauseInMiddleWithLongSoTimeout()
      throws Exception {

    myServerSocketThread.setSimulateOneSecondPauseInChunkedEncoding(true);

    String message = // -
        "MSH|^~\\&|||||200803051508||ADT^A31|2|P|2.5\r"
            + // -
            "EVN||200803051509|||||||||||||||||||||||||||||||||||||||||\r"
            + // -
            "PID|||ZZZZZZ83M64Z148R^^^SSN^SSN^^20070103\r"; // -

    HohRawClientSimple client = new HohRawClientSimple("localhost", myPort, "/theUri");
    client.setSoTimeout(980);
    client.setKeepAlive(false);
    client.setResponseTimeout(2000);
    client.setAuthorizationCallback(new SingleCredentialClientCallback("hello", "hapiworld"));
    IReceivable<String> response = client.sendAndReceive(new RawSendable(message));

    ourLog.info("Received response");

    assertEquals(message, myServerSocketThread.getMessage());
    assertEquals(myServerSocketThread.getReply().encode(), response.getMessage());

    assertEquals(EncodingStyle.ER7.getContentType(), myServerSocketThread.getContentType());
    assertEquals(EncodingStyle.ER7, myServerSocketThread.getEncoding());
  }