Configures the proxy.
The distant side has to send back one (1) mandatory response message.

@param msg      the custom message sent as configuration tip
@return the mandatory response message of the configuration.
501642
public ZMsg configure(ZMsg msg)
    {
        msg.addFirst(CONFIG);

        if (agent.send(msg)) {
            // consume the status in the pipe
            recvStatus();

            ZMsg reply = agent.recv();
            assert (reply != null);

            // refill the pipe with status
            agent.send(STATUS);
            return reply;
        }
        return null;
    }
470117
public void trace(final String msg) {
        if (proxy.isTraceEnabled()) {
            if (proxy instanceof LocationAwareLogger) {
                ((LocationAwareLogger) proxy).log(null, FQCN, LocationAwareLogger.TRACE_INT, msg, null, null);
            } else {
                proxy.trace(msg);
            }
        }
    }
744306
public Stream add(StreamFragmentBean msg) {
        Stream stream = streamCache.getUnchecked(msg.getHeader().getId());
        stream.add(msg);
        return stream;
    }
1184753
protected static String buildMessage(String msg) {
        StackTraceElement caller = new Throwable().fillInStackTrace().getStackTrace()[2];
        return caller.getClassName() + "." + caller.getMethodName() + "(): \n" + msg;
    }
852808
public void info(final String msg) {
        if (proxy.isInfoEnabled()) {
            if (proxy instanceof LocationAwareLogger) {
                ((LocationAwareLogger) proxy).log(null, FQCN, LocationAwareLogger.INFO_INT, msg, null, null);
            } else {
                proxy.info(msg);
            }
        }
    }
377419
private ResponseEncapsulation recvMessage() throws IOException {
    GeneratedMessage msg = null;
    byte[] headers = new byte[8];
    recv(headers, headers.length);

    if (headers[0] != 'L' || headers[1] != '1') {
      throw new IOException("Wrong launcher protocol header");
    }

    ByteBuffer buf = ByteBuffer.allocate(4);
    buf.order(ByteOrder.BIG_ENDIAN);
    buf.put(headers, 4, 4);
    buf.flip();

    int size = buf.getInt();

    logger.finest("RECV: type=" + ((int) headers[3]) + ", command="
                  + ((int) headers[2]) + ", size=" + size);

    byte[] data = new byte[size];
    recv(data, size);

    boolean success = (headers[3] == (byte) 1);
    MessageType type = MessageType.get(headers[2]);

    if (type == null) {
      throw new IOException("Unable to determine message type");
    }

    if ((headers[3] != (byte) 1) && (headers[3] != (byte) 2)) {
      throw new IOException("Unable to determine success or error");
    }

    switch (type) {
      case MSG_HELLO: {
        LauncherHandshakeResponse.Builder response = LauncherHandshakeResponse.newBuilder();
        buildMessage(response, data);
        msg = response.build();
        break;
      }

      case MSG_START:
      case MSG_STATUS:
      case MSG_STOP: {
        LauncherStatusResponse.Builder response = LauncherStatusResponse.newBuilder();
        buildMessage(response, data);
        msg = response.build();
        break;
      }

      case MSG_SCREENSHOT: {
        LauncherScreenshotResponse.Builder response = LauncherScreenshotResponse.newBuilder();
        buildMessage(response, data);
        msg = response.build();
        break;
      }

    }

    return new ResponseEncapsulation(success, msg);
  }
376074
public static Response getExceptionResponse(final int status, final String msg) {
		return Response.status(status).entity(new LinkedHashMap<String, Object>() {
			private static final long serialVersionUID = 1L;
			{
				put("code", status);
				put("message", msg);
			}
		}).type(MediaType.APPLICATION_JSON).build();
	}
675668
private Message createMessageProxy(Message msgObject) {

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "createMessageProxy", msgObject);

        Message retObj;
        try {

            retObj = (Message) Proxy.newProxyInstance(msgObject.getClass().getClassLoader(),
                                                      msgObject.getClass().getInterfaces(),
                                                      new MessageProxyInvocationHandler(msgObject));
        } catch (Exception e) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                SibTr.debug(tc, "Exception caught while trying to createMessageProxy ", e);

            //if any exception .. return the same msgObject.
            retObj = msgObject;

        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "createMessageProxy", retObj);

        return retObj;

    }
586579
public static void v(com.couchbase.lite.LogDomain domain, String msg) {
        sendToLoggers(com.couchbase.lite.LogLevel.VERBOSE, domain, msg);
    }
767162
function receive(msg) {
  var requests = [];
  var responses = [];

  if (!this.active) {
    return this;
  }

  // If we got JSON, parse it
  if (typeof msg === 'string') {
    try {
      msg = JSON.parse(msg);
    } catch (e) {
      // The specification doesn't force us to respond in error, ignoring
      return this;
    }
  }

  // If we get a standard single-type batch, dispatch it
  if (msg.constructor === Array) {
    if (msg.length === 0) {
      return this;
    }
    // Hint of request batch
    if (typeof msg[0].method === 'string') {
      requests = msg;
    } else {
      responses = msg;
    }
  } else if (typeof msg === 'object') {
    // Could we be a 'dual-batch' extended message?
    if (
      typeof msg.requests !== 'undefined'
      && typeof msg.responses !== 'undefined'
    ) {
      requests = msg.requests;
      responses = msg.responses;
    } else if (typeof msg.method === 'string') {
      // We're a single request
      requests.push(msg);
    } else {
      // We must be a single response
      responses.push(msg);
    }
  }

  responses.forEach(deliverResponse.bind(this));
  requests.forEach(serveRequest.bind(this));
  return this;
}
355145
@Override
    protected MessageResolverStrategy configureMessageResolverStrategy() {
        final MessageResolverStrategy candidate = configuredMessageResolverStrategy();
        return candidate == null ? super.configureMessageResolverStrategy() : candidate;
    }
782609
public final String translate (InvocationContext ctx, String msg)
    {
        return _msgmgr.getMessage(ctx.getRequest(), msg);
    }
627967
public void e(final String msg) {
        logMgr.log(tag, LogLevelConst.ERROR, msg, null);
    }
461449
public Object sendMessageAndGetReply() throws RemoteException
    {
        try {
            URL url = this.getProxyURL();
            ServletMessage servlet = new ServletMessage(url);
            InputStream in = servlet.sendMessage(m_properties);
            InputStreamReader reader = new InputStreamReader(in);
            BufferedReader buffReader = new BufferedReader(reader);
            String string = "";
            while (true)
            {
                String str = buffReader.readLine();
                if ((str == null) || (str.length() == 0))
                    break;
                if (string.length() > 0)
                    string += "\n";
                string += str;
            }
System.out.println("ProxyTransport.sendandreceive() reply: " + string);
            return string;
        } catch (MalformedURLException ex)  {
            ex.printStackTrace();
        } catch (IOException ex)  {
            ex.printStackTrace();
        }
        return null;
    }
1178840
public void sendBasicMessageAsync(Session session, BasicMessage msg) {
        String text = ApiDeserializer.toHawkularFormat(msg);
        sendTextAsync(session, text);
    }
1323725
private void configureProxyServer(ChannelPipeline clientPipeline) {
        if (proxyServerConfiguration != null && sslConfig != null) {
            if (proxyServerConfiguration.getProxyUsername() != null
                    && proxyServerConfiguration.getProxyPassword() != null) {
                clientPipeline.addLast(Constants.PROXY_HANDLER,
                        new HttpProxyHandler(proxyServerConfiguration.getInetSocketAddress(),
                                proxyServerConfiguration.getProxyUsername(),
                                proxyServerConfiguration.getProxyPassword()));
            } else {
                clientPipeline.addLast(Constants.PROXY_HANDLER,
                        new HttpProxyHandler(proxyServerConfiguration.getInetSocketAddress()));
            }
        }
    }
72625
protected void configureMessageController(ApplicationContext context) {
        if (context.containsBean(MESSAGE_CONTROLLER_BEAN_NAME)) {
            HttpMessageController messageController = context.getBean(MESSAGE_CONTROLLER_BEAN_NAME, HttpMessageController.class);
            EndpointAdapter endpointAdapter = httpServer.getEndpointAdapter();

            HttpEndpointConfiguration endpointConfiguration = new HttpEndpointConfiguration();
            endpointConfiguration.setMessageConverter(httpServer.getMessageConverter());
            endpointConfiguration.setHeaderMapper(DefaultHttpHeaderMapper.inboundMapper());
            endpointConfiguration.setHandleAttributeHeaders(httpServer.isHandleAttributeHeaders());
            endpointConfiguration.setHandleCookies(httpServer.isHandleCookies());
            endpointConfiguration.setDefaultStatusCode(httpServer.getDefaultStatusCode());
            messageController.setEndpointConfiguration(endpointConfiguration);

            if (endpointAdapter != null) {
                messageController.setEndpointAdapter(endpointAdapter);
            }
        }
    }