@Test public void openOutputStream() throws Exception { final MyConnectionFactory factory = create( new String[] { Protocols.HTTP.protocol() }, 1 ); final StreamConnection conn = mock( StreamConnection.class ); final Semaphore semaphore = new Semaphore( 0 ); final OutputStream out = new OutputStream() { @Override public void write( final int b ) throws IOException { semaphore.release(); } }; when( conn.openOutputStream() ).thenReturn( out ); registerConnectionFactory( factory ); factory.setConnection( conn ); final OutputStream dout = this.connectorService.openOutputStream( Protocols.HTTP.url() ); dout.write( 0 ); assertTrue( "OpenOutputStream.write never called?!", semaphore.tryAcquire( 1, TimeUnit.SECONDS ) ); }
@Override public OutputStream openOutputStream( final String aName ) throws IOException { return openStreamConnection( aName ).openOutputStream(); }
ConnectorServiceImpl implements ConnectorService { @Override public OutputStream openOutputStream( final String aName ) throws IOException { return openStreamConnection( aName ).openOutputStream(); } }
ConnectorServiceImpl implements ConnectorService { @Override public OutputStream openOutputStream( final String aName ) throws IOException { return openStreamConnection( aName ).openOutputStream(); } ConnectorServiceImpl( final BundleContext aContext ); }
ConnectorServiceImpl implements ConnectorService { @Override public OutputStream openOutputStream( final String aName ) throws IOException { return openStreamConnection( aName ).openOutputStream(); } ConnectorServiceImpl( final BundleContext aContext ); @Override Connection open( final String aName ); @Override Connection open( final String aName, final int aMode ); @Override Connection open( final String aName, final int aMode, final boolean aTimeouts ); @Override DataInputStream openDataInputStream( final String aName ); @Override DataOutputStream openDataOutputStream( final String aName ); @Override InputStream openInputStream( final String aName ); @Override OutputStream openOutputStream( final String aName ); void shutdown(); }
ConnectorServiceImpl implements ConnectorService { @Override public OutputStream openOutputStream( final String aName ) throws IOException { return openStreamConnection( aName ).openOutputStream(); } ConnectorServiceImpl( final BundleContext aContext ); @Override Connection open( final String aName ); @Override Connection open( final String aName, final int aMode ); @Override Connection open( final String aName, final int aMode, final boolean aTimeouts ); @Override DataInputStream openDataInputStream( final String aName ); @Override DataOutputStream openDataOutputStream( final String aName ); @Override InputStream openInputStream( final String aName ); @Override OutputStream openOutputStream( final String aName ); void shutdown();  }