### Question:
TyrusRemoteEndpoint implements javax.websocket.RemoteEndpoint { public void close(CloseReason cr) { LOGGER.fine("Close public void close(CloseReason cr): " + cr); webSocket.close(cr); } private  TyrusRemoteEndpoint(TyrusSession session, TyrusWebSocket socket, TyrusEndpointWrapper endpointWrapper); @Override void sendPing(ByteBuffer applicationData); @Override void sendPong(ByteBuffer applicationData); @Override String toString(); @Override void setBatchingAllowed(boolean allowed); @Override boolean getBatchingAllowed(); @Override void flushBatch(); void close(CloseReason cr);  }### Answer:
@Test public void testGetSendStream() throws IOException { TestRemoteEndpoint tre = new TestRemoteEndpoint(); TyrusSession testSession = createTestSession(tre, endpointWrapper); TyrusRemoteEndpoint.Basic rew = new TyrusRemoteEndpoint.Basic(testSession, tre, endpointWrapper); OutputStream stream = rew.getSendStream(); for (byte b : sentBytes) { stream.write(b); } stream.flush(); stream.write(sentBytes); stream.close(); Assert.assertArrayEquals("Writing byte[] to stream and flushing.", sentBytesComplete, tre.getBytesAndClearBuffer()); }
@Test public void testGetSendStreamWriteArrayWhole() throws IOException { TestRemoteEndpoint tre = new TestRemoteEndpoint(); TyrusSession testSession = createTestSession(tre, endpointWrapper); TyrusRemoteEndpoint.Basic rew = new TyrusRemoteEndpoint.Basic(testSession, tre, endpointWrapper); OutputStream stream = rew.getSendStream(); stream.write(sentBytesComplete); Assert.assertEquals(6, tre.getLastSentMessageSize()); stream.close(); Assert.assertEquals(0, tre.getLastSentMessageSize()); Assert.assertArrayEquals("Writing byte[] to stream and flushing.", sentBytesComplete, tre.getBytesAndClearBuffer()); }
@Test public void testGetSendStreamWriteArrayPerPartes() throws IOException { TestRemoteEndpoint tre = new TestRemoteEndpoint(); TyrusSession testSession = createTestSession(tre, endpointWrapper); TyrusRemoteEndpoint.Basic rew = new TyrusRemoteEndpoint.Basic(testSession, tre, endpointWrapper); OutputStream stream = rew.getSendStream(); stream.write(sentBytes); Assert.assertEquals(3, tre.getLastSentMessageSize()); stream.write(sentBytes); Assert.assertEquals(3, tre.getLastSentMessageSize()); stream.close(); Assert.assertEquals(0, tre.getLastSentMessageSize()); Assert.assertArrayEquals("Writing byte[] to stream and flushing.", sentBytesComplete, tre.getBytesAndClearBuffer()); }