public final class NetConnection extends AbstractNetConnection implements INetConnection
NetConnection
- implementation of the INetConnection
interface.INetConnection.Configuration, INetConnection.IListener, INetConnection.ListenerAdapter
CALL_BADVERSION, CALL_FAILED, CONNECT_APPSHUTDOWN, CONNECT_BANDWIDTH, CONNECT_CLOSED, CONNECT_FAILED, CONNECT_INVALID_APPLICATION, CONNECT_REJECTED, CONNECT_SUCCESS, defaultObjectEncoding, PROXY_TYPE_BEST, PROXY_TYPE_CONNECT, PROXY_TYPE_HTTP, PROXY_TYPE_NONE
Constructor and Description |
---|
NetConnection()
Constructor.
|
NetConnection(java.util.Map<java.lang.String,java.lang.Object> configuration)
Constructor.
|
NetConnection(java.util.Map<java.lang.String,java.lang.Object> configuration,
java.util.concurrent.ExecutorService dispatcher,
java.util.concurrent.ScheduledExecutorService scheduler)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addHeader(java.lang.String operation,
boolean mustUnderstand,
java.lang.Object param)
Adds a context header to the AMF packet structure.
|
void |
call(java.lang.String command,
Responder responder,
java.lang.Object... args)
Invokes a command or method on the server, or on an application server,
to which the application instance is connected.
|
void |
close()
Closes the connection.
|
void |
connect(java.lang.String url,
java.lang.Object... args)
Opens a connection to a server.
|
boolean |
connected()
Checks if it is connected to the server.
|
java.lang.String |
connectedProxyType()
If a successful connection is made, indicates the method that was used to
make it: a direct connection, the CONNECT method, or HTTP tunneling.
|
ProtocolLayerInfo |
getInfo()
Returns connection info (read/written bytes/packets).
|
int |
getUploadBufferSize()
Returns upload buffer size.
|
void |
onBWDone()
'onBWDone' invoked by FMS server.
|
void |
onBWDone(java.lang.Object... args)
'onBWDone' invoked by FMS server.
|
void |
setMaxUploadBandwidth(int bandwidth)
Sets max upload bandwidth (in bytes per second).
|
static void |
setSwfFileSizeAndHash(java.util.Map<java.lang.String,java.lang.Object> configuration,
java.io.File swf)
Sets
Configuration#SWF_HASH and Configuration#SWF_SIZE values using
swf file. |
boolean |
usingTLS()
Indicates whether a secure connection was made using native
Transport Layer Security (TLS) rather than HTTPS.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addEventListener, client, client, configuration, objectEncoding, objectEncoding, proxyType, proxyType, removeEventListener, uri
public NetConnection()
public NetConnection(java.util.Map<java.lang.String,java.lang.Object> configuration)
configuration
- connection configurationpublic NetConnection(java.util.Map<java.lang.String,java.lang.Object> configuration, java.util.concurrent.ExecutorService dispatcher, java.util.concurrent.ScheduledExecutorService scheduler)
configuration
- connection configurationdispatcher
- dispatcherscheduler
- schedulerpublic static void setSwfFileSizeAndHash(java.util.Map<java.lang.String,java.lang.Object> configuration, java.io.File swf) throws java.lang.Exception
Configuration#SWF_HASH
and Configuration#SWF_SIZE
values using
swf
file.configuration
- swf
- SWF filejava.lang.Exception
- if an exception occurredpublic void addHeader(java.lang.String operation, boolean mustUnderstand, java.lang.Object param)
INetConnection
addHeader
in interface INetConnection
operation
- identifies the header and the object data associated with itmustUnderstand
- (default = false
) — A value of
true
indicates that the server must understand and process
this header before it handles any of the following headers or messages.param
- (default = null
) — any objectpublic void call(java.lang.String command, Responder responder, java.lang.Object... args)
INetConnection
call
in interface INetConnection
command
- commandresponder
- an optional object that is used to handle return values from the serverargs
- command argumentspublic void close()
INetConnection
close
in interface INetConnection
public void connect(java.lang.String url, java.lang.Object... args)
INetConnection
connect
in interface INetConnection
url
- url to connectargs
- connection argumentspublic boolean connected()
INetConnection
connected
in interface INetConnection
true
if connected; false
otherwisepublic java.lang.String connectedProxyType()
INetConnection
connectedProxyType
in interface INetConnection
public boolean usingTLS()
INetConnection
usingTLS
in interface INetConnection
public ProtocolLayerInfo getInfo()
INetConnection
getInfo
in interface INetConnection
public int getUploadBufferSize()
INetConnection
getUploadBufferSize
in interface INetConnection
public void setMaxUploadBandwidth(int bandwidth)
INetConnection
Note:
- you can change max upload bandwidth after connection is established
only if INetConnection.Configuration.MAX_UPLOAD_BANDWIDTH
configuration property
was set positive before connection is established.
setMaxUploadBandwidth
in interface INetConnection
bandwidth
- max upload bandwidthpublic void onBWDone()
public void onBWDone(java.lang.Object... args)
args
- arguments