If you're talking about an HTTP connection on port 80 then you need to the target serve to provide a cross-domain policy file.
http://www.adobe.com/devnet/flashplayer/articles/cross_domain_policy.html
When an attempt is made to load content into a SWF file at runtime, the request is subject to the Flash Player security model, which is in place to protect users and website owners. As part of this model, Flash Player by default prevents cross-domain loading of data, but allows cross-domain sending of data.
<!-- crossdomain.xml in root -->
<cross-domain-policy>
<allow-access-from domain="*" />
</cross-domain-policy>
If you're talking about a socket connection on another port, then to setup a socket policy server to provide a policy file on a specific port. It needs to listen for connections on port 843 and then serve up a policy file which specifies which domains are allowed access to which local ports.
<cross-domain-policy>
<allow-access-from domain="swf.example.com" to-ports="123,456-458" />
</cross-domain-policy>
There are free options for hosting a separate process to serve this file or you can implement it yourself within your current Java application.
http://www.adobeopenoptions.com/devnet/flashplayer/articles/socket_policy_files.html