code: public ResponseEncapsulation sendRequest(MessageType type, byte[] body) throws IOException {
      sendRequestHeader(type, (body != null) ? body.length : 0);
      if (body != null) {
        os.write(body);
      }
      return recvMessage();
    }
docs: Send a request and receive a result.
  
  @param type the request type to be sent
  @param body the serialized request payload
  @return the response
  @throws IOException if socket read error or protocol parse error