125 Utils.close(delegate.channel()); 126 } 127 128 @Override 129 protected ByteBuffer readImpl(int length) throws IOException { 130 ByteBuffer buf = sslDelegate.allocate(BufType.PACKET, length); 131 WrapperResult r = sslDelegate.recvData(buf); 132 // TODO: check for closure 133 String s = "Receive) "; 134 //debugPrint(s, r.buf); 135 return r.buf; 136 } 137 138 @Override 139 protected int readImpl(ByteBuffer buf) throws IOException { 140 // TODO: need to ensure that buf is big enough for application data 141 WrapperResult r = sslDelegate.recvData(buf); 142 // TODO: check for closure 143 String s = "Receive) "; 144 //debugPrint(s, r.buf); 145 return r.result.bytesProduced(); 146 } 147 148 @Override 149 boolean connected() { 150 return delegate.connected(); 151 } 152 153 @Override 154 SocketChannel channel() { 155 return delegate.channel(); 156 } 157 158 @Override 159 CompletableFuture<Void> whenReceivingResponse() { 160 return delegate.whenReceivingResponse(); 161 } 162 163 @Override 164 boolean isSecure() { | 125 Utils.close(delegate.channel()); 126 } 127 128 @Override 129 protected ByteBuffer readImpl(int length) throws IOException { 130 ByteBuffer buf = sslDelegate.allocate(BufType.PACKET, length); 131 WrapperResult r = sslDelegate.recvData(buf); 132 // TODO: check for closure 133 String s = "Receive) "; 134 //debugPrint(s, r.buf); 135 return r.buf; 136 } 137 138 @Override 139 protected int readImpl(ByteBuffer buf) throws IOException { 140 // TODO: need to ensure that buf is big enough for application data 141 WrapperResult r = sslDelegate.recvData(buf); 142 // TODO: check for closure 143 String s = "Receive) "; 144 //debugPrint(s, r.buf); 145 if (r.result.bytesProduced() > 0) { 146 assert buf == r.buf; 147 } 148 return r.result.bytesProduced(); 149 } 150 151 @Override 152 boolean connected() { 153 return delegate.connected(); 154 } 155 156 @Override 157 SocketChannel channel() { 158 return delegate.channel(); 159 } 160 161 @Override 162 CompletableFuture<Void> whenReceivingResponse() { 163 return delegate.whenReceivingResponse(); 164 } 165 166 @Override 167 boolean isSecure() { |