@Test public void sendStream() throws IOException { ServerConnection connection = ServerConnection.getInstance(); Whitebox.setInternalState(connection, "connectionsClient", mockClient); connection.sendStream(); }
public PipedOutputStream sendStream() throws IOException { if (connectionsClient == null) { Log.e(TAG, "connectionsClient is null, cannot create stream."); throw new IOException("connectionsClient is null, cannot create stream."); } PipedInputStream stream = new PipedInputStream(); PipedOutputStream data = new PipedOutputStream(stream); Payload payload = Payload.fromStream(stream); connectionsClient.sendPayload(clientID, payload); Log.d(TAG, "Sent test payload to receiver " + clientID); return data; }
ServerConnection implements PayloadHandling { public PipedOutputStream sendStream() throws IOException { if (connectionsClient == null) { Log.e(TAG, "connectionsClient is null, cannot create stream."); throw new IOException("connectionsClient is null, cannot create stream."); } PipedInputStream stream = new PipedInputStream(); PipedOutputStream data = new PipedOutputStream(stream); Payload payload = Payload.fromStream(stream); connectionsClient.sendPayload(clientID, payload); Log.d(TAG, "Sent test payload to receiver " + clientID); return data; } }
ServerConnection implements PayloadHandling { public PipedOutputStream sendStream() throws IOException { if (connectionsClient == null) { Log.e(TAG, "connectionsClient is null, cannot create stream."); throw new IOException("connectionsClient is null, cannot create stream."); } PipedInputStream stream = new PipedInputStream(); PipedOutputStream data = new PipedOutputStream(stream); Payload payload = Payload.fromStream(stream); connectionsClient.sendPayload(clientID, payload); Log.d(TAG, "Sent test payload to receiver " + clientID); return data; } private  ServerConnection(); }
ServerConnection implements PayloadHandling { public PipedOutputStream sendStream() throws IOException { if (connectionsClient == null) { Log.e(TAG, "connectionsClient is null, cannot create stream."); throw new IOException("connectionsClient is null, cannot create stream."); } PipedInputStream stream = new PipedInputStream(); PipedOutputStream data = new PipedOutputStream(stream); Payload payload = Payload.fromStream(stream); connectionsClient.sendPayload(clientID, payload); Log.d(TAG, "Sent test payload to receiver " + clientID); return data; } private  ServerConnection(); static ServerConnection getInstance(); void init(Context ctx); @Override void addHandle(int type, HandlePayload handle); @Override HandlePayload getHandle(int type); @Override void handlePayload(Payload payload); @Override void handlePayloadUpdate(PayloadTransferUpdate update); void discover(ConnectCallback callback, EndpointDiscoveryCallback discoveryCallback); List<String> getClients(); String getClientID(); void discoverConnect(String code, ConnectCallback callback); void connectTo(String code, ConnectCallback callback); void abort(); PipedOutputStream sendStream(); EndpointDiscoveryCallback buildEndpointDiscoveryCallback(String name, ConnectCallback callback); boolean isConnected(); }
ServerConnection implements PayloadHandling { public PipedOutputStream sendStream() throws IOException { if (connectionsClient == null) { Log.e(TAG, "connectionsClient is null, cannot create stream."); throw new IOException("connectionsClient is null, cannot create stream."); } PipedInputStream stream = new PipedInputStream(); PipedOutputStream data = new PipedOutputStream(stream); Payload payload = Payload.fromStream(stream); connectionsClient.sendPayload(clientID, payload); Log.d(TAG, "Sent test payload to receiver " + clientID); return data; } private  ServerConnection(); static ServerConnection getInstance(); void init(Context ctx); @Override void addHandle(int type, HandlePayload handle); @Override HandlePayload getHandle(int type); @Override void handlePayload(Payload payload); @Override void handlePayloadUpdate(PayloadTransferUpdate update); void discover(ConnectCallback callback, EndpointDiscoveryCallback discoveryCallback); List<String> getClients(); String getClientID(); void discoverConnect(String code, ConnectCallback callback); void connectTo(String code, ConnectCallback callback); void abort(); PipedOutputStream sendStream(); EndpointDiscoveryCallback buildEndpointDiscoveryCallback(String name, ConnectCallback callback); boolean isConnected();  }