2 * ============LICENSE_START=======================================================
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 * ============LICENSE_END=========================================================
17 package com.woorea.openstack.connector;
19 import java.io.FilterInputStream;
20 import java.io.IOException;
21 import java.io.InputStream;
22 import java.net.SocketException;
24 import org.jboss.resteasy.client.ClientExecutor;
27 public class RESTEasyInputStream extends FilterInputStream {
29 protected ClientExecutor clientExecutor;
31 public RESTEasyInputStream(InputStream inputStream, ClientExecutor clientExecutor) {
33 this.clientExecutor = clientExecutor;
37 public void close() throws IOException {
39 clientExecutor.close();
40 } catch (Exception e) {
41 // Silently skip errors in the socket close errors
46 } catch (SocketException e) {
47 // We expect this exception because the socket is closed
48 } catch (IllegalStateException e) {
49 // We expect this exception because the socket is closed (httpclient 4.2)