net.javacrumbs.mocksocket.connection
Class UniversalMockConnection

java.lang.Object
  extended by net.javacrumbs.mocksocket.connection.UniversalMockConnection
All Implemented Interfaces:
Connection, MockConnection, UniversalMockRecorder

public class UniversalMockConnection
extends Object
implements UniversalMockRecorder, MockConnection

Mock connection that creates and wraps either SequentialMockConnection or MatcherBasedMockConnection.

Author:
Lukas Krecan

Constructor Summary
UniversalMockConnection(String address)
           
 
Method Summary
 SequentialMockRecorder andReturn(byte[] data)
           
 MatcherBasedMockResultRecorder andWhenPayload(org.hamcrest.Matcher<byte[]> matcher)
           
 boolean containsRequestThat(org.hamcrest.Matcher<byte[]> matcher)
           
 InputStream getInputStream()
           
 OutputStream getOutputStream()
           
 int numberOfRequests()
           
 void onCreate()
           
 byte[] requestData(int i)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UniversalMockConnection

public UniversalMockConnection(String address)
Method Detail

andReturn

public SequentialMockRecorder andReturn(byte[] data)
Specified by:
andReturn in interface UniversalMockRecorder

andWhenPayload

public MatcherBasedMockResultRecorder andWhenPayload(org.hamcrest.Matcher<byte[]> matcher)
Specified by:
andWhenPayload in interface UniversalMockRecorder

onCreate

public void onCreate()
Specified by:
onCreate in interface MockConnection

getInputStream

public InputStream getInputStream()
                           throws IOException
Specified by:
getInputStream in interface Connection
Throws:
IOException

getOutputStream

public OutputStream getOutputStream()
                             throws IOException
Specified by:
getOutputStream in interface Connection
Throws:
IOException

requestData

public byte[] requestData(int i)
Specified by:
requestData in interface MockConnection

numberOfRequests

public int numberOfRequests()
Specified by:
numberOfRequests in interface MockConnection

containsRequestThat

public boolean containsRequestThat(org.hamcrest.Matcher<byte[]> matcher)
Specified by:
containsRequestThat in interface MockConnection


Copyright © 2011. All Rights Reserved.