Returns a new JingleMediaSession.

@param payloadType payloadType
@param remote      remote Candidate
@param local       local Candidate
@return JingleMediaSession JingleMediaSession
501718
@Override
    public JingleMediaSession createMediaSession(PayloadType payloadType, final TransportCandidate remote, final TransportCandidate local, final JingleSession jingleSession) {
        for (JingleMediaManager manager : managers) {
            if (manager.getPayloads().contains(payloadType)) {
                return manager.createMediaSession(payloadType, remote, local, jingleSession);
            }
        }
        return null;
    }
829003
public <T> Optional<T> PUT(String partialUrl, Object payload, GenericType<T> returnType)
    {    
        URI uri = buildUri(partialUrl);   
        return executePutRequest(uri, payload, null, null, returnType);
    }
470709
public String buildMessagePayload(TestContext context, String messageType) {
        try {    
            //construct control message payload
            String messagePayload = "";
            if (scriptResourcePath != null) {
                messagePayload = buildMarkupBuilderScript(context.replaceDynamicContentInString(
                        FileUtils.readToString(FileUtils.getFileResource(scriptResourcePath, context), Charset.forName(context.resolveDynamicValue(scriptResourceCharset)))));
            } else if (scriptData != null) {
                messagePayload = buildMarkupBuilderScript(context.replaceDynamicContentInString(scriptData));
            }
            
            return messagePayload;
        } catch (IOException e) {
            throw new CitrusRuntimeException("Failed to build control message payload", e);
        }
    }
950087
private IQ receiveSessionAcceptAction(Jingle jingle, JingleDescription description) throws JingleException {
        IQ response = null;
        PayloadType.Audio agreedCommonAudioPt;

        if (bestCommonAudioPt == null) {
            // Update the best common audio PT
            bestCommonAudioPt = calculateBestCommonAudioPt(remoteAudioPts);
            // response = createAcceptMessage();
        }

        List<PayloadType> offeredPayloads = description.getAudioPayloadTypesList();
        if (!offeredPayloads.isEmpty()) {
            if (offeredPayloads.size() == 1) {
                agreedCommonAudioPt = (PayloadType.Audio) offeredPayloads.get(0);
                if (bestCommonAudioPt != null) {
                    // If the accepted PT matches the best payload
                    // everything is fine
                    if (!agreedCommonAudioPt.equals(bestCommonAudioPt)) {
                        throw new JingleException(JingleError.NEGOTIATION_ERROR);
                    }
                }

            } else if (offeredPayloads.size() > 1) {
                throw new JingleException(JingleError.MALFORMED_STANZA);
            }
        }

        return response;
    }
313016
private void triggerContentEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc) throws NotConnectedException, InterruptedException {

        // Let the session know that we've established a content/media segment.
        JingleSession session = getSession();
        if (session != null) {
            List<JingleListener> listeners = session.getListenersList();
            for (JingleListener li : listeners) {
                if (li instanceof JingleSessionListener) {
                    JingleSessionListener sli = (JingleSessionListener) li;
                    sli.sessionEstablished(pt, rc, lc, session);
                }
            }
        }

        // Create a media session for each media manager in the session.
        if (mediaNeg.getMediaManager() != null) {
            rc.removeCandidateEcho();
            lc.removeCandidateEcho();

            jingleMediaSession = getMediaNegotiator().getMediaManager().createMediaSession(pt, rc, lc, session);
            jingleMediaSession.addMediaReceivedListener(session);
            if (jingleMediaSession != null) {

                jingleMediaSession.startTransmit();
                jingleMediaSession.startReceive();

                for (TransportCandidate candidate : getTransportNegotiator().getOfferedCandidates())
                    candidate.removeCandidateEcho();
            }
            JingleMediaManager mediaManager = getMediaNegotiator().getMediaManager();
            getSession().addJingleMediaSession(mediaManager.getName(), jingleMediaSession);
        }

    }
751032
private synchronized void sendPayloadRequest(final PayloadData payload) {
		ApptentiveLog.v(PAYLOADS, "Sending payload: %s", payload);

		// create request object
		final HttpRequest payloadRequest = requestSender.createPayloadSendRequest(payload, new HttpRequest.Listener<HttpRequest>() {
			@Override
			public void onFinish(HttpRequest request) {
				try {
					String json = StringUtils.isNullOrEmpty(request.getResponseData()) ? "{}" : request.getResponseData();
					final JSONObject responseData = new JSONObject(json);
					handleFinishSendingPayload(payload, false, null, request.getResponseCode(), responseData);
				} catch (Exception e) {
					// TODO: Stop assuming the response is JSON. In fact, just send bytes back, and whatever part of the SDK needs it can try to convert it to the desired format.
					ApptentiveLog.e(PAYLOADS, e, "Exception while handling payload send response");
					logException(e);

					handleFinishSendingPayload(payload, false, null, -1, null);
				}
			}

			@Override
			public void onCancel(HttpRequest request) {
				handleFinishSendingPayload(payload, true, null, request.getResponseCode(), null);
			}

			@Override
			public void onFail(HttpRequest request, String reason) {
				if (request.isAuthenticationFailure()) {
					ApptentiveNotificationCenter.defaultCenter().postNotification(NOTIFICATION_AUTHENTICATION_FAILED, NOTIFICATION_KEY_CONVERSATION_ID, payload.getConversationId(), NOTIFICATION_KEY_AUTHENTICATION_FAILED_REASON, request.getAuthenticationFailedReason());
				}
				handleFinishSendingPayload(payload, false, reason, request.getResponseCode(), null);
			}
		});

		// set 'retry' policy
		payloadRequest.setRetryPolicy(requestRetryPolicy);
		payloadRequest.setCallbackQueue(conversationQueue());
		payloadRequest.start();
	}
752840
public static WebservicesBndType createWebServicesBndType(String path, StringType version, Map<String, ServiceRefType> serviceRefMap) {
        WebservicesBndType wsbnd = new WebservicesBndType(path);
        wsbnd.version = version;
        wsbnd.serviceRefTypeMap = serviceRefMap;
        wsbnd.idMap = new ComponentIDMap();
        return wsbnd;
    }
352331
@Bean
	public RemoteServiceCaller remoteServiceCaller(Optional<EasyTransRpcConsumer> optionalConsumer,
			@Lazy Optional<EasyTransMsgPublisher> optionalPublisher, ObjectSerializer serializer,
			QueueTopicMapper queueTopicMapper) {

		EasyTransRpcConsumer consumer = optionalConsumer.orElseGet(() -> new EasyTransRpcConsumer() {

			@Override
			public <P extends EasyTransRequest<R, ?>, R extends Serializable> R call(String appId, String busCode,
					String innerMethod, Map<String, Object> header, P params) {
				throw new RuntimeException("can not find EasyTransRpcConsumer implement but try handle rpc request");
			}

			@Override
			public <P extends EasyTransRequest<R, ?>, R extends Serializable> void callWithNoReturn(String appId,
					String busCode, String innerMethod, Map<String, Object> header, P params) {
				throw new RuntimeException("can not find EasyTransRpcConsumer implement but try handle rpc request");
			}
		});

		EasyTransMsgPublisher publisher = optionalPublisher.orElseGet(() -> new EasyTransMsgPublisher() {

			@Override
			public EasyTransMsgPublishResult publish(String topic, String tag, String key, Map<String, Object> header,
					byte[] msgByte) {
				throw new RuntimeException("can not find EasyTransMsgPublisher implement but try to publish a message");
			}
		});

		return new RemoteServiceCaller(consumer, publisher, serializer, queueTopicMapper);
	}
1229729
@Override
    public InventoryMessage makeInventoryMessage(byte[] payloadBytes, int length) throws ProtocolException {
        return new InventoryMessage(params, payloadBytes, this, length);
    }
831974
@Override
    public ExternalStorageLocation getLocation(Operation operation, PayloadType payloadType, String path) {
        String uri;
        switch (payloadType) {
            case WORKFLOW_INPUT:
            case WORKFLOW_OUTPUT:
                uri = "workflow";
                break;
            case TASK_INPUT:
            case TASK_OUTPUT:
                uri = "tasks";
                break;
            default:
                throw new ConductorClientException(String.format("Invalid payload type: %s for operation: %s", payloadType.toString(), operation.toString()));
        }
        return clientBase.getForEntity(String.format("%s/externalstoragelocation", uri), new Object[]{"path", path, "operation", operation.toString(), "payloadType", payloadType.toString()}, ExternalStorageLocation.class);
    }
455935
function(payload, callback) {
    var alice, bob, aliceChannel, bobChannel,
      aliceCandidates = [],
      aliceOffer;
    alice = peercon();
    bob = peercon();
    bob.on('ondatachannel', function (msg) {
      bobChannel = datachan(msg.channel);
      bobChannel.setBinaryType('arraybuffer', function () {});
      bobChannel.on('onmessage', function (msg) {
        alice.close();
        bob.close();
        callback(msg);
      });
    });
    bob.on('onicecandidate', function (msg) {
      msg.candidate && alice.addIceCandidate(msg.candidate);
    });
    alice.on('onicecandidate', function (msg) {
      // firefox needs ice candidates all sent before asking for an answer.
      if (!msg.candidate) {
        bob.setRemoteDescription(aliceOffer).then(function () {
          var last;
          while (aliceCandidates.length) {
            last = bob.addIceCandidate(aliceCandidates.shift());
          }
          return last;
        }).then(function () {
          return bob.createAnswer();
        }).then(function (answer) {
          return bob.setLocalDescription(answer).then(function () {return answer; });
        }).then(function (answer) {
          return alice.setRemoteDescription(answer);
        }, function (err) {
          console.error('RTC failed: ', err);
        });
      } else {
        aliceCandidates.push(msg.candidate);
      }
    });
    alice.createDataChannel('channel').then(function (id) {
      aliceChannel = datachan(id);
      aliceChannel.on('onopen', function () {
        if (payload instanceof ArrayBuffer) {
          aliceChannel.sendBuffer(payload);
        } else {
          aliceChannel.send(payload);
        }
      });
      aliceChannel.setBinaryType('arraybuffer').then(function () {
        return alice.createOffer();
      }).then(function (offer) {
        alice.setLocalDescription(offer);
        aliceOffer = offer;
      });
    }, function (err) {
      console.error('RTC failed: ', err);
    });
  }
220116
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (com.google.api.ads.admanager.axis.v201805.PublisherQueryLanguageServiceInterface.class.isAssignableFrom(serviceEndpointInterface)) {
                com.google.api.ads.admanager.axis.v201805.PublisherQueryLanguageServiceSoapBindingStub _stub = new com.google.api.ads.admanager.axis.v201805.PublisherQueryLanguageServiceSoapBindingStub(new java.net.URL(PublisherQueryLanguageServiceInterfacePort_address), this);
                _stub.setPortName(getPublisherQueryLanguageServiceInterfacePortWSDDServiceName());
                return _stub;
            }
        }
        catch (java.lang.Throwable t) {
            throw new javax.xml.rpc.ServiceException(t);
        }
        throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
    }
396872
@Override
  public <T> EventHandler<T> getHandler(
      final RemoteIdentifier destinationIdentifier, final Class<? extends T> messageType) {

    if (LOG.isLoggable(Level.FINE)) {
      LOG.log(Level.FINE, "RemoteManager: {0} destinationIdentifier: {1} messageType: {2}",
          new Object[] {this.name, destinationIdentifier, messageType.getCanonicalName()});
    }

    return new ProxyEventHandler<>(this.myIdentifier, destinationIdentifier,
        "default", this.reSendStage.<T>getHandler(), this.seqGen);
  }
656346
private IQ receiveSessionInfoAction(Jingle jingle, JingleDescription description) throws JingleException {
        IQ response = null;
        PayloadType oldBestCommonAudioPt = bestCommonAudioPt;
        List<PayloadType> offeredPayloads;
        boolean ptChange = false;

        offeredPayloads = description.getAudioPayloadTypesList();
        if (!offeredPayloads.isEmpty()) {

            synchronized (remoteAudioPts) {
                remoteAudioPts.clear();
                remoteAudioPts.addAll(offeredPayloads);
            }

            // Calculate the best common codec
            bestCommonAudioPt = calculateBestCommonAudioPt(remoteAudioPts);
            if (bestCommonAudioPt != null) {
                // and send an accept if we have an agreement...
                ptChange = !bestCommonAudioPt.equals(oldBestCommonAudioPt);
                if (oldBestCommonAudioPt == null || ptChange) {
                    // response = createAcceptMessage();
                }
            } else {
                throw new JingleException(JingleError.NO_COMMON_PAYLOAD);
            }
        }

        // Parse the Jingle and get the payload accepted
        return response;
    }
101996
private IQ receiveSessionInitiateAction(Jingle jingle, JingleDescription description) {
        IQ response = null;

        List<PayloadType> offeredPayloads = description.getAudioPayloadTypesList();
        bestCommonAudioPt = calculateBestCommonAudioPt(offeredPayloads);

        synchronized (remoteAudioPts) {
            remoteAudioPts.addAll(offeredPayloads);
        }

        // If there are suitable/matching payload types then accept this content.
        if (bestCommonAudioPt != null) {
            // Let the transport negotiators sort-out connectivity and content-accept instead.
            // response = createAudioPayloadTypesOffer();
            setNegotiatorState(JingleNegotiatorState.PENDING);
        } else {
            // Don't really know what to send here.  XEP-166 is not clear.
            setNegotiatorState(JingleNegotiatorState.FAILED);
        }

        return response;
    }
1197618
public static CommandLatencyId create(SocketAddress localAddress, SocketAddress remoteAddress, ProtocolKeyword commandType) {
        return new CommandLatencyId(localAddress, remoteAddress, commandType);
    }
214479
def get_instance(self, payload):
        
        return MediaInstance(
            self._version,
            payload,
            account_sid=self._solution['account_sid'],
            message_sid=self._solution['message_sid'],
        )