class ClientSender extends StreamSender implements BlockingSender {

  public Message blockingSend(Message message) throws CommunicationException {
    final MessageRequiringResponse messageRequiringResponse =
      new MessageRequiringResponse(message);

    final Message result;

    synchronized (m_socketWrapper) {
      send(messageRequiringResponse);

      final Receiver receiver =
        new StreamReceiver(m_socketWrapper.getInputStream());

      result = receiver.waitForMessage();
    }

    if (result == null) {
      throw new CommunicationException("Shut down");
    }
    else if (result instanceof NoResponseMessage) {
      throw new NoResponseException("Server did not respond");
    }

    return result;
  }

  private  ClientSender(SocketWrapper socketWrapper);

}