### Question:
TcpTransport implements Transport, ConnectionObserver { @Override public void listen() { serverSocketChannel = asyncTcpSocketFactory.bind(socketAddress); acceptNewConnection(); } TcpTransport(final PublishingConnectionObserver publishingTransportObserver, final InetSocketAddress socketAddress,
                        final SocketFactory asyncTcpSocketFactory, final TransportConfig transportConfig); @Override void connect(); @Override void listen(); @Override void stopListening(); @Override ReadableByteChannel getReadableByteChannel(); @Override WritableByteChannel getWritableByteChannel(); @Override void killSocket(); @Override void close(); @Override boolean isConnected(); @Override void registerTransportObserver(final ConnectionObserver connectionObserver); @Override void unregisterTransportObserver(final ConnectionObserver connectionObserver); @Override void connectionEstablished(); @Override void connectionClosed();  }### Answer:
@Test public void shouldBindToSocketOnListen() throws Exception { final TcpTransport tcpTransport = new TcpTransport(publishingTransportObserver, socketAddress, socketFactory, new TransportConfigImpl(false)); mockery.checking(new Expectations() { { one(socketFactory).bind(socketAddress); will(returnValue(serverSocketChannel)); one(socketFactory).createSocketOnIncomingConnection(with(serverSocketChannel), with(any(SocketFactory.SocketEstablishedCallback.class))); } }); tcpTransport.listen(); }