91 } 92 boolean remove(CompletionStage<?> cf) { 93 synchronized(operations) { 94 return operations.remove(cf); 95 } 96 } 97 } 98 99 final void addTrailingOperation(CompletionStage<?> cf) { 100 trailingOperations.add(cf); 101 } 102 103 // final void removeTrailingOperation(CompletableFuture<?> cf) { 104 // trailingOperations.remove(cf); 105 // } 106 107 final HttpClientImpl client() { 108 return client; 109 } 110 111 //public abstract void connect() throws IOException, InterruptedException; 112 113 public abstract CompletableFuture<Void> connectAsync(); 114 115 /** Tells whether, or not, this connection is connected to its destination. */ 116 abstract boolean connected(); 117 118 /** Tells whether, or not, this connection is secure ( over SSL ) */ 119 abstract boolean isSecure(); 120 121 /** 122 * Tells whether, or not, this connection is proxied. 123 * Returns true for tunnel connections, or clear connection to 124 * any host through proxy. 125 */ 126 abstract boolean isProxied(); 127 128 /** Tells whether, or not, this connection is open. */ 129 final boolean isOpen() { 130 return channel().isOpen() && 131 (connected() ? !getConnectionFlow().isFinished() : true); 132 } 133 | 91 } 92 boolean remove(CompletionStage<?> cf) { 93 synchronized(operations) { 94 return operations.remove(cf); 95 } 96 } 97 } 98 99 final void addTrailingOperation(CompletionStage<?> cf) { 100 trailingOperations.add(cf); 101 } 102 103 // final void removeTrailingOperation(CompletableFuture<?> cf) { 104 // trailingOperations.remove(cf); 105 // } 106 107 final HttpClientImpl client() { 108 return client; 109 } 110 111 /** 112 * Initiates the connect and returns a CompletableFuture that completes 113 * when the initial connection phase has been established or an error 114 * occurs. The given exchange provides access connect timeout configuration. 115 */ 116 public abstract CompletableFuture<Void> connectAsync(Exchange<?> exchange); 117 118 /** Completes the connection phase. Must be called after connectAsync. */ 119 public abstract CompletableFuture<Void> finishConnect(); 120 121 /** Tells whether, or not, this connection is connected to its destination. */ 122 abstract boolean connected(); 123 124 /** Tells whether, or not, this connection is secure ( over SSL ) */ 125 abstract boolean isSecure(); 126 127 /** 128 * Tells whether, or not, this connection is proxied. 129 * Returns true for tunnel connections, or clear connection to 130 * any host through proxy. 131 */ 132 abstract boolean isProxied(); 133 134 /** Tells whether, or not, this connection is open. */ 135 final boolean isOpen() { 136 return channel().isOpen() && 137 (connected() ? !getConnectionFlow().isFinished() : true); 138 } 139 |