org.atmosphere.wasync.impl
Class DefaultSocket

java.lang.Object
  extended by org.atmosphere.wasync.impl.DefaultSocket
All Implemented Interfaces:
Socket

public class DefaultSocket
extends Object
implements Socket


Nested Class Summary
protected static class DefaultSocket.InternalSocket
           
 
Nested classes/interfaces inherited from interface org.atmosphere.wasync.Socket
Socket.EVENT
 
Field Summary
protected  Transport transportInUse
           
 
Constructor Summary
DefaultSocket(Options options)
           
 
Method Summary
 void close()
          Close this Socket
protected  Socket connect(com.ning.http.client.RequestBuilder r, List<Transport> transports)
           
protected  Socket connect(com.ning.http.client.RequestBuilder r, List<Transport> transports, long timeout, TimeUnit tu)
           
 Future fire(Object data)
          Send data to the remote Server.
protected  List<Transport> getTransport(com.ning.http.client.RequestBuilder r, Request request)
           
protected  DefaultSocket.InternalSocket internalSocket()
           
 Socket on(Function<? extends Object> function)
          Associate a Function with the Socket.
 Socket on(String functionName, Function<? extends Object> function)
          Associate a Function with the Socket.
 Socket open(Request request)
          Connect to the remote Server using the Request's information.
 Socket open(Request request, long timeout, TimeUnit tu)
          Connect to the remote Server using the Request's information, will timeout if the connection failed to open within a certain time
protected  Request request()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

transportInUse

protected Transport transportInUse
Constructor Detail

DefaultSocket

public DefaultSocket(Options options)
Method Detail

fire

public Future fire(Object data)
            throws IOException
Description copied from interface: Socket
Send data to the remote Server.

Specified by:
fire in interface Socket
Returns:
a Future
Throws:
IOException

on

public Socket on(Function<? extends Object> function)
Description copied from interface: Socket
Associate a Function with the Socket. When a response is received, the library will try to associated the decoded message (decoded by Decoder) to the defined type of the Function

Specified by:
on in interface Socket
Parameters:
function - a Function
Returns:
this

on

public Socket on(String functionName,
                 Function<? extends Object> function)
Description copied from interface: Socket
Associate a Function with the Socket. When a response is received, the library will try to associated the decoded message (decoded by Decoder) to the defined type of the Function. The default messages are defined by Function.MESSAGE but handling of custom message can be done using a FunctionResolver

Specified by:
on in interface Socket
function - a Function
Returns:
this

open

public Socket open(Request request)
            throws IOException
Description copied from interface: Socket
Connect to the remote Server using the Request's information.

Specified by:
open in interface Socket
Parameters:
request - a Request
Returns:
this
Throws:
IOException

open

public Socket open(Request request,
                   long timeout,
                   TimeUnit tu)
            throws IOException
Description copied from interface: Socket
Connect to the remote Server using the Request's information, will timeout if the connection failed to open within a certain time

Specified by:
open in interface Socket
Parameters:
request - a Request
timeout - the maximum time to wait
Returns:
this
Throws:
IOException

connect

protected Socket connect(com.ning.http.client.RequestBuilder r,
                         List<Transport> transports)
                  throws IOException
Throws:
IOException

connect

protected Socket connect(com.ning.http.client.RequestBuilder r,
                         List<Transport> transports,
                         long timeout,
                         TimeUnit tu)
                  throws IOException
Throws:
IOException

close

public void close()
Description copied from interface: Socket
Close this Socket

Specified by:
close in interface Socket

internalSocket

protected DefaultSocket.InternalSocket internalSocket()

getTransport

protected List<Transport> getTransport(com.ning.http.client.RequestBuilder r,
                                       Request request)
                                throws IOException
Throws:
IOException

request

protected Request request()


Copyright © 2013. All Rights Reserved.