String destination = message.getDestination();
HTTPProxyDestination dest = (HTTPProxyDestination)destinations.get(destination);
//use the remote settings if the message didn't specify them
FlexRemoteCredentials remoteCredentials =
FlexContext.getFlexSession().getRemoteCredentials(getId(), destination);
if (remoteCredentials != null)
{
message.setRemoteUsername(remoteCredentials.getUsername());
message.setRemotePassword((String)remoteCredentials.getCredentials());
}
else if (dest.getRemoteUsername() != null && dest.getRemotePassword() != null)
{
message.setRemoteUsername(dest.getRemoteUsername());
message.setRemotePassword(dest.getRemotePassword());