Send this message to the server and return the reply.
@return The message.
2554
public Object sendMessageAndGetReply() throws RemoteException
    {
        URL url = null;
        try {
            url = this.getProxyURL();
        } catch (MalformedURLException ex) {
            ex.printStackTrace();
            return null;
        }
        ServletMessage servlet = new ServletMessage(url);
        while (true)
        {   // to allow for retry on timeout
            long time = 0;
            try {
                time = System.currentTimeMillis();
                InputStream in = servlet.sendMessage(m_properties);
                InputStreamReader reader = new InputStreamReader(in);
                BufferedReader buffReader = new BufferedReader(reader);
                String string = Constants.BLANK;
                while (true)
                {
                    String str = buffReader.readLine();
                    if ((str == null) || (str.length() == 0))
                        break;
                    if (string.length() > 0)
                        string += "\n";
                    string += str;
                }
                return string;
            } catch (IOException ex)  {
                if (System.currentTimeMillis() > time + MAX_WAIT_TIME)
                    continue;   // Server timeout, try again
                throw new RemoteException(ex.getMessage() + ' ' + url, ex.getCause());
            }
        }
    }
610821
private void reply(final String response, final boolean error,
            final String errorMessage, final String stackTrace,
            final String statusCode, final int statusCodeInt,
            Map<String, List<String>> responseHeaders) {

        if (!sentReply) {
            // must update sentReply first to avoid duplicated msg.
            sentReply = true;

            final ResponseOnSingeRequest res = new ResponseOnSingeRequest(
                    response, error, errorMessage, stackTrace, statusCode,
                    statusCodeInt, PcDateUtils.getNowDateTimeStrStandard(),
                    responseHeaders);
            if (!getContext().system().deadLetters().equals(sender)) {
                sender.tell(res, getSelf());
            }
            if (getContext() != null) {
                getContext().stop(getSelf());
            }
        }

    }
1178465
@Override
    public String getMessage() {
        if (message_ != null) {
            return message_;
        }

        if (getCause() != null) {
            return getCause().getMessage();
        }

        switch (code_) {
            case UNSPECIFIED_ERR:
                return "unknown error";
            case NOT_SUPPORTED_ERR:
                return "not supported";
            case SYNTAX_ERR:
                return "syntax error";
            default:
                return null;
        }
    }
1369644
public BaseMessage sendMessageRequest(BaseMessage messageOut)
    {
        // create some properties and get the default Session
        TrxMessageHeader trxMessageHeader = (TrxMessageHeader)messageOut.getMessageHeader();

        String strFrom = (String)trxMessageHeader.get(TrxMessageHeader.REPLY_TO_PARAM);
        if (strFrom == null)
            strFrom = this.getProperty((TrxMessageHeader)messageOut.getMessageHeader(), TrxMessageHeader.REPLY_TO_PARAM); // See if there is an email default.
        String strSubject = (String)trxMessageHeader.get(SUBJECT_PARAM);
        String strTrxID = (String)trxMessageHeader.get(TrxMessageHeader.LOG_TRX_ID);
        if (strSubject == null)
            strSubject = "Message"; // Lame
        if (strTrxID != null)
            strSubject = strSubject + " (" + strTrxID + ")";

        Properties props = new Properties();
        String strSendBy = (String)trxMessageHeader.get(SEND_TRANSPORT);
        if (strSendBy == null)
            strSendBy = "smtp";
        String strHost = (String)trxMessageHeader.get(SMTP_HOST);
        if (strHost == null)
            strHost = (String)trxMessageHeader.get(HOST_PARAM);
        props.put(SMTP_HOST, strHost);
        String strAuth = (String)trxMessageHeader.get(SMTP_AUTH);   // "true"?
        if (strAuth != null)
            props.put(SMTP_AUTH, strAuth);
        if ((String)trxMessageHeader.get(SMTP_TLS)!= null)   // "true"?
            props.put(SMTP_TLS, (String)trxMessageHeader.get(SMTP_TLS));
        if ((String)trxMessageHeader.get("mail.smtp.socketFactory.port")!= null)
            props.put("mail.smtp.socketFactory.port", (String)trxMessageHeader.get("mail.smtp.socketFactory.port"));
        if ((String)trxMessageHeader.get("mail.smtp.socketFactory.class")!= null)
            props.put("mail.smtp.socketFactory.class", (String)trxMessageHeader.get("mail.smtp.socketFactory.class"));
        if ((String)trxMessageHeader.get("mail.smtp.socketFactory.fallback")!= null)
            props.put("mail.smtp.socketFactory.fallback", (String)trxMessageHeader.get("mail.smtp.socketFactory.fallback"));
        Session session = Session.getDefaultInstance(props);
        Properties sessionProp = session.getProperties();
        if (!sessionProp.equals(props))
            session = Session.getInstance(props);
        session.setDebug(DEBUG);
        
        String username = (String)trxMessageHeader.get(SMTP_USERNAME);
        if (username == null)
            if (DBConstants.TRUE.equalsIgnoreCase(strAuth))
                username = strFrom;
        String password = (String)trxMessageHeader.get(SMTP_PASSWORD);
        password =  PasswordPropertiesField.decrypt(password);

        Transport transport = null;
      
        String strDest = this.getDestination(trxMessageHeader);
        MimeMessage msg = new MimeMessage(session);
        try
        {
            InternetAddress sender = new InternetAddress(strFrom);
            InternetAddress[] address = {new InternetAddress(strDest)};

            msg.setFrom(sender);
            msg.setRecipients(Message.RecipientType.TO, address);
            msg.setSubject(strSubject);
            msg.setSentDate(new Date());
            
            String msgHtml = (String)messageOut.get(ManualMessage.MESSAGE_PARAM);  // The physical message
            if (msgHtml == null)
                msgHtml = (String)messageOut.getExternalMessage().getRawData();

            if (msgHtml == null)
                msgHtml = "";
            // add the Multipart to the message
            String strContentType = (String)trxMessageHeader.get(CONTENT_TYPE_PARAM);
            if (strContentType == null)
                strContentType = "text/html";
            msg.setContent(msgHtml, strContentType);
           
            msg.saveChanges();
             
            transport = session.getTransport(strSendBy);
            //         if (DBConstants.TRUE.equalsIgnoreCase(strAuth))
            transport.connect(strHost, username, password);
            //xaddress = msg.getAllRecipients(); //Don't do this - bug in javax.mail
            transport.sendMessage(msg, address);
            // send the message
            this.logMessage(strTrxID, messageOut, MessageInfoTypeModel.REQUEST, MessageTypeModel.MESSAGE_OUT, MessageStatusModel.SENT, null, null, null, -1, -1, msg, strDest);
        } catch (MessagingException mex) {
            mex.printStackTrace();
            String strError = mex.getMessage();
            Exception ex = null;
            if ((ex = mex.getNextException()) != null)
            {
                strError = strError + ", " + ex.getMessage();
                ex.printStackTrace();
            }
            this.logMessage(strTrxID, messageOut, MessageInfoTypeModel.REQUEST, MessageTypeModel.MESSAGE_OUT, MessageStatusModel.ERROR, null, null, strError, -1, -1, msg, strDest);
        } finally {
            try
            {
                transport.close();
            }
            catch (Exception e)
            {}
        }
        return null;    // You never have an (immediate) reply from an email request.
    }
556986
public ResponseOnSingeRequest executeSshCommand() {
        ResponseOnSingeRequest sshResponse = new ResponseOnSingeRequest();

        try {
            session = startSshSessionAndObtainSession();
            channel = sessionConnectGenerateChannel(session);
            sshResponse = executeAndGenResponse((ChannelExec) channel);

        } catch (Exception e) {
            sshResponse = genErrorResponse(e);
        } finally {

            if (session != null)
                session.disconnect();
            if (channel != null)
                channel.disconnect();
        }

        return sshResponse;

    }
558689
public Observable<ComapiResult<MessageSentResponse>> sendMessage(@NonNull final String conversationId, @NonNull final MessageToSend message) {

        final String token = getToken();

        if (sessionController.isCreatingSession()) {
            return getTaskQueue().queueSendMessage(conversationId, message);
        } else if (TextUtils.isEmpty(token)) {
            return Observable.error(getSessionStateErrorDescription());
        } else {
            return doSendMessage(token, conversationId, message);
        }
    }
1075090
protected HttpResponse sendImpl() throws IOException {
    HttpURLConnection con = (HttpURLConnection) uri.toURL().openConnection();
    con.setConnectTimeout(connectTimeout);
    con.setReadTimeout(readTimeout);
    con.setRequestMethod(method);
    for (Map.Entry<String, String> h : reqHeaders.entrySet()) {
      con.setRequestProperty(h.getKey(), h.getValue());
    }
    configureHTTPS(con);

    boolean canRetry = true;
    try {
      con.setDoInput(true);

      // HttpURLConnection will change method to POST if there is a body associated
      // with a GET request. Only try to write entity if it is not empty.
      entry.withRequestContentLength(entity.length).mark("start");
      if (entity.length > 0) {
        con.setDoOutput(true);
        try (OutputStream out = con.getOutputStream()) {
          out.write(entity);
        }
      }

      int status = con.getResponseCode();
      canRetry = (status >= 500 || status == 429);
      entry.mark("complete").withStatusCode(status);

      // A null key is used to return the status line, remove it before sending to
      // the log entry or creating the response object
      Map<String, List<String>> headers = new LinkedHashMap<>(con.getHeaderFields());
      headers.remove(null);
      for (Map.Entry<String, List<String>> h : headers.entrySet()) {
        for (String v : h.getValue()) {
          entry.withResponseHeader(h.getKey(), v);
        }
      }

      try (InputStream in = (status >= 400) ? con.getErrorStream() : con.getInputStream()) {
        byte[] data = readAll(in);
        entry.withResponseContentLength(data.length);
        return new HttpResponse(status, headers, data);
      }
    } catch (IOException e) {
      entry.mark("complete").withException(e);
      throw e;
    } finally {
      entry.withCanRetry(canRetry);
      HttpLogEntry.logClientRequest(entry);
    }
  }
389300
@Override
	public AbstractMessage copy()
    {
        ObjectMessageImpl clone = new ObjectMessageImpl();
        copyCommonFields(clone);
        clone.body = this.body;
        
        return clone;
    }
789133
public byte[] nextMessage() throws SshException {
		if (Log.isDebugEnabled()) {
			if (verbose) {
				Log.debug(this, "transport next message");
			}
		}
		synchronized (transportIn) {

			byte[] msg;

			do {
				msg = readMessage();
			} while (processMessage(msg));
			return msg;
		}

	}
1353206
public static Function<Message, MailMessage> toMailMessage() {
		return new Function<Message, MailMessage>() {
			@Override
			public MailMessage apply(final Message input) {
				return MailMessage.fromMessage(input);
			}
		};
	}
961504
protected HttpResponse sendImpl() throws IOException {
    HttpURLConnection con = (HttpURLConnection) uri.toURL().openConnection();
    con.setConnectTimeout(connectTimeout);
    con.setReadTimeout(readTimeout);
    con.setRequestMethod(method);
    for (Map.Entry<String, String> h : reqHeaders.entrySet()) {
      entry.addRequestHeader(h.getKey(), h.getValue());
      con.setRequestProperty(h.getKey(), h.getValue());
    }
    configureHTTPS(con);

    try {
      con.setDoInput(true);

      // HttpURLConnection will change method to POST if there is a body associated
      // with a GET request. Only try to write entity if it is not empty.
      entry.markStart();
      if (entity.length > 0) {
        con.setDoOutput(true);
        try (OutputStream out = con.getOutputStream()) {
          out.write(entity);
        }
      }

      int status = con.getResponseCode();
      entry.markEnd().withHttpStatus(status);

      // A null key is used to return the status line, remove it before sending to
      // the log entry or creating the response object
      Map<String, List<String>> headers = new LinkedHashMap<>(con.getHeaderFields());
      headers.remove(null);
      for (Map.Entry<String, List<String>> h : headers.entrySet()) {
        for (String v : h.getValue()) {
          entry.addResponseHeader(h.getKey(), v);
        }
      }

      try (InputStream in = (status >= 400) ? con.getErrorStream() : con.getInputStream()) {
        byte[] data = readAll(in);
        return new HttpResponse(status, headers, data);
      }
    } catch (IOException e) {
      entry.markEnd().withException(e);
      throw e;
    } finally {
      entry.log();
    }
  }
665816
public void reply(Object message) {
        if (context.sender() != null) {
            context.sender().send(message, self());
        }
    }
736058
public Boolean send(String message) {
        TextWebSocketFrame frame = new TextWebSocketFrame(message);
        if (getCh() != null) {
            getCh().writeAndFlush(frame);
            return true;
        }
        return false;
    }
1221650
protected Response post() {
        RequestBuilder builder = RequestBuilder.post().setUri(url);
        return getResponseAfterDetectingType(builder);
    }
356784
public HttpRequestMessageImpl getRequest() {
        HttpRequestMessageImpl req = (HttpRequestMessageImpl) this.reqPool.get();
        if (null == req) {
            req = new HttpRequestMessageImpl();
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "getRequest(): " + req);
        }
        return req;
    }
25320
@Override
    public String getMessage() {
        String message = super.getMessage();

        if (message == null) {
            message = "";
        }

        if (hexdump != null) {
            return message + (message.length() > 0 ? " " : "") + "(Hexdump: "
                    + hexdump + ')';
        }

        return message;
    }
1113158
public String text() {
        try {
            connect();
            return responseCode() >= 400 ? read(connection.getErrorStream()) : read(connection.getInputStream());
        } catch (IOException e) {
            throw new HttpException("Failed URL: " + url, e);
        }finally {
            dispose();
        }
    }