44import java .io .InputStream ;
55import java .io .OutputStream ;
66import java .nio .ByteBuffer ;
7+ import java .nio .Buffer ;
78import java .util .concurrent .CountDownLatch ;
89import java .util .concurrent .ExecutorService ;
910import java .util .concurrent .Executors ;
@@ -23,7 +24,7 @@ public void testRead() throws Exception {
2324 }
2425
2526 ByteBuffer buf = ByteBuffer .allocate (1 ).put (new byte [] { (byte ) 3 });
26- stream .queue .put ((ByteBuffer ) buf .rewind ());
27+ stream .queue .put ((ByteBuffer ) (( Buffer ) buf ) .rewind ());
2728 Assert .assertEquals (stream .queue .size (), 1 );
2829 try (InputStream in = stream .getInput ()) {
2930 Assert .assertEquals (in .read (), 3 );
@@ -34,7 +35,7 @@ public void testRead() throws Exception {
3435 }
3536
3637 buf = ByteBuffer .allocate (2 ).put (new byte [] { (byte ) 3 , (byte ) 4 });
37- stream .queue .put ((ByteBuffer ) buf .rewind ());
38+ stream .queue .put ((ByteBuffer ) (( Buffer ) buf ) .rewind ());
3839 Assert .assertEquals (stream .queue .size (), 1 );
3940 try (InputStream in = stream .getInput ()) {
4041 Assert .assertEquals (in .read (), 3 );
@@ -52,7 +53,7 @@ public void testRead() throws Exception {
5253 Assert .assertEquals (in .read (), -1 );
5354 }
5455
55- stream .queue .put ((ByteBuffer ) buf .rewind ());
56+ stream .queue .put ((ByteBuffer ) (( Buffer ) buf ) .rewind ());
5657 stream .queue .put (buf );
5758 stream .queue .put (ClickHousePipedStream .EMPTY );
5859 Assert .assertEquals (stream .queue .size (), 3 );
@@ -90,15 +91,15 @@ public void testReadBytes() throws Exception {
9091 }
9192
9293 ByteBuffer buf = ByteBuffer .allocate (2 ).put (new byte [] { (byte ) 3 , (byte ) 4 });
93- stream .queue .put ((ByteBuffer ) buf .rewind ());
94+ stream .queue .put ((ByteBuffer ) (( Buffer ) buf ) .rewind ());
9495 Assert .assertEquals (stream .queue .size (), 1 );
9596 try (InputStream in = stream .getInput ()) {
9697 in .read (bytes );
9798 Assert .fail ("Read should be timed out" );
9899 } catch (IOException e ) {
99100 Assert .assertTrue (e .getMessage ().indexOf ("Read timed out" ) == 0 );
100101 }
101- stream .queue .put ((ByteBuffer ) buf .rewind ());
102+ stream .queue .put ((ByteBuffer ) (( Buffer ) buf ) .rewind ());
102103 Assert .assertEquals (stream .queue .size (), 1 );
103104 try (InputStream in = stream .getInput ()) {
104105 Assert .assertEquals (in .read (bytes , 0 , 2 ), 2 );
@@ -107,7 +108,7 @@ public void testReadBytes() throws Exception {
107108 } catch (IOException e ) {
108109 Assert .assertTrue (e .getMessage ().indexOf ("Read timed out" ) == 0 );
109110 }
110- stream .queue .put ((ByteBuffer ) buf .rewind ());
111+ stream .queue .put ((ByteBuffer ) (( Buffer ) buf ) .rewind ());
111112 Assert .assertEquals (stream .queue .size (), 1 );
112113 try (InputStream in = stream .getInput ()) {
113114 in .read (bytes , 0 , 3 );
@@ -117,7 +118,7 @@ public void testReadBytes() throws Exception {
117118 }
118119
119120 buf = ByteBuffer .allocate (2 ).put (new byte [] { (byte ) 3 , (byte ) 4 });
120- stream .queue .put ((ByteBuffer ) buf .rewind ());
121+ stream .queue .put ((ByteBuffer ) (( Buffer ) buf ) .rewind ());
121122 stream .queue .put (ClickHousePipedStream .EMPTY );
122123 Assert .assertEquals (stream .queue .size (), 2 );
123124 try (InputStream in = stream .getInput ()) {
0 commit comments