net.javacrumbs.mocksocket
Class AbstractMockSocketImpl

java.lang.Object
  extended by java.net.SocketImpl
      extended by net.javacrumbs.mocksocket.AbstractMockSocketImpl
All Implemented Interfaces:
SocketOptions
Direct Known Subclasses:
ConnectionFactoryMockSocketImpl

public abstract class AbstractMockSocketImpl
extends SocketImpl


Field Summary
 
Fields inherited from class java.net.SocketImpl
address, fd, localport, port
 
Fields inherited from interface java.net.SocketOptions
IP_MULTICAST_IF, IP_MULTICAST_IF2, IP_MULTICAST_LOOP, IP_TOS, SO_BINDADDR, SO_BROADCAST, SO_KEEPALIVE, SO_LINGER, SO_OOBINLINE, SO_RCVBUF, SO_REUSEADDR, SO_SNDBUF, SO_TIMEOUT, TCP_NODELAY
 
Constructor Summary
AbstractMockSocketImpl()
           
 
Method Summary
protected  void accept(SocketImpl s)
           
protected  int available()
           
protected  void bind(InetAddress host, int port)
           
protected  void close()
           
protected  void connect(InetAddress address, int port)
           
protected  void connect(SocketAddress address, int timeout)
           
protected  void connect(String host, int port)
           
protected  void create(boolean stream)
           
 Object getOption(int optID)
           
protected  void listen(int backlog)
           
protected abstract  void onConnect(String address)
          Onvoked on a connect method call.
protected  void sendUrgentData(int data)
           
 void setOption(int optID, Object value)
           
 
Methods inherited from class java.net.SocketImpl
getFileDescriptor, getInetAddress, getInputStream, getLocalPort, getOutputStream, getPort, setPerformancePreferences, shutdownInput, shutdownOutput, supportsUrgentData, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractMockSocketImpl

public AbstractMockSocketImpl()
Method Detail

onConnect

protected abstract void onConnect(String address)
Onvoked on a connect method call.

Parameters:
address - host:port

setOption

public void setOption(int optID,
                      Object value)
               throws SocketException
Throws:
SocketException

getOption

public Object getOption(int optID)
                 throws SocketException
Throws:
SocketException

create

protected void create(boolean stream)
               throws IOException
Specified by:
create in class SocketImpl
Throws:
IOException

connect

protected void connect(String host,
                       int port)
                throws IOException
Specified by:
connect in class SocketImpl
Throws:
IOException

connect

protected void connect(InetAddress address,
                       int port)
                throws IOException
Specified by:
connect in class SocketImpl
Throws:
IOException

connect

protected void connect(SocketAddress address,
                       int timeout)
                throws IOException
Specified by:
connect in class SocketImpl
Throws:
IOException

bind

protected void bind(InetAddress host,
                    int port)
             throws IOException
Specified by:
bind in class SocketImpl
Throws:
IOException

listen

protected void listen(int backlog)
               throws IOException
Specified by:
listen in class SocketImpl
Throws:
IOException

accept

protected void accept(SocketImpl s)
               throws IOException
Specified by:
accept in class SocketImpl
Throws:
IOException

available

protected int available()
                 throws IOException
Specified by:
available in class SocketImpl
Throws:
IOException

sendUrgentData

protected void sendUrgentData(int data)
                       throws IOException
Specified by:
sendUrgentData in class SocketImpl
Throws:
IOException

close

protected void close()
              throws IOException
Specified by:
close in class SocketImpl
Throws:
IOException


Copyright © 2011. All Rights Reserved.