### Question:
Streams { public DefaultStream getOrCreate(final long streamId, final StreamListener handler) { DefaultStream stream = streams.get(streamId); if (stream == null) { stream = new DefaultStream( streamId, frameSender, handler, StreamType.Bidirectional); final DefaultStream existingStream = streams.putIfAbsent(streamId, stream); if (existingStream != null) { stream = existingStream; } } return stream; } Streams(final FrameSender frameSender); Stream openStream(
      final boolean client, final boolean bidirectional, final StreamListener handler); DefaultStream getOrCreate(final long streamId, final StreamListener handler); void onAck(final long pn);  }### Answer:
@Test public void createAndThenGet() { final long streamId = StreamId.random(true, true); final DefaultStream stream1 = streams.getOrCreate(streamId, listener); final DefaultStream stream2 = streams.getOrCreate(streamId, listener); assertSame(stream1, stream2); final DefaultStream stream3 = streams.getOrCreate(StreamId.random(true, true), listener); assertNotSame(stream1, stream3); }