static void replaceProtocol(ProtocolSocketFactory socketFactory, String schema, int defaultPort) { // // switch protocol // due to how HttpCommons work internally this dance is best to be kept as is // Protocol directHttp = Protocol.getProtocol(schema); if (directHttp instanceof DelegatedProtocol) { // unwrap the original directHttp = ((DelegatedProtocol)directHttp).getOriginal(); assert directHttp instanceof DelegatedProtocol == false; } Protocol proxiedHttp = new DelegatedProtocol(socketFactory, directHttp, schema, defaultPort); // NB: register the new protocol since when using absolute URIs, HttpClient#executeMethod will override the configuration (#387) // NB: hence why the original/direct http protocol is saved - as otherwise the connection is not closed since it is considered different // NB: (as the protocol identities don't match) // this is not really needed since it's being replaced later on // hostConfig.setHost(proxyHost, proxyPort, proxiedHttp); Protocol.registerProtocol(schema, proxiedHttp); // end dance }
static void replaceProtocol(ProtocolSocketFactory socketFactory, String schema, int defaultPort) { // // switch protocol // due to how HttpCommons work internally this dance is best to be kept as is // Protocol directHttp = Protocol.getProtocol(schema); if (directHttp instanceof DelegatedProtocol) { // unwrap the original directHttp = ((DelegatedProtocol)directHttp).getOriginal(); assert directHttp instanceof DelegatedProtocol == false; } Protocol proxiedHttp = new DelegatedProtocol(socketFactory, directHttp, schema, defaultPort); // NB: register the new protocol since when using absolute URIs, HttpClient#executeMethod will override the configuration (#387) // NB: hence why the original/direct http protocol is saved - as otherwise the connection is not closed since it is considered different // NB: (as the protocol identities don't match) // this is not really needed since it's being replaced later on // hostConfig.setHost(proxyHost, proxyPort, proxiedHttp); Protocol.registerProtocol(schema, proxiedHttp); // end dance }
static void replaceProtocol(ProtocolSocketFactory socketFactory, String schema, int defaultPort) { // // switch protocol // due to how HttpCommons work internally this dance is best to be kept as is // Protocol directHttp = Protocol.getProtocol(schema); if (directHttp instanceof DelegatedProtocol) { // unwrap the original directHttp = ((DelegatedProtocol)directHttp).getOriginal(); assert directHttp instanceof DelegatedProtocol == false; } Protocol proxiedHttp = new DelegatedProtocol(socketFactory, directHttp, schema, defaultPort); // NB: register the new protocol since when using absolute URIs, HttpClient#executeMethod will override the configuration (#387) // NB: hence why the original/direct http protocol is saved - as otherwise the connection is not closed since it is considered different // NB: (as the protocol identities don't match) // this is not really needed since it's being replaced later on // hostConfig.setHost(proxyHost, proxyPort, proxiedHttp); Protocol.registerProtocol(schema, proxiedHttp); // end dance }
static void replaceProtocol(ProtocolSocketFactory socketFactory, String schema, int defaultPort) { // // switch protocol // due to how HttpCommons work internally this dance is best to be kept as is // Protocol directHttp = Protocol.getProtocol(schema); if (directHttp instanceof DelegatedProtocol) { // unwrap the original directHttp = ((DelegatedProtocol)directHttp).getOriginal(); assert directHttp instanceof DelegatedProtocol == false; } Protocol proxiedHttp = new DelegatedProtocol(socketFactory, directHttp, schema, defaultPort); // NB: register the new protocol since when using absolute URIs, HttpClient#executeMethod will override the configuration (#387) // NB: hence why the original/direct http protocol is saved - as otherwise the connection is not closed since it is considered different // NB: (as the protocol identities don't match) // this is not really needed since it's being replaced later on // hostConfig.setHost(proxyHost, proxyPort, proxiedHttp); Protocol.registerProtocol(schema, proxiedHttp); // end dance }
static void replaceProtocol(ProtocolSocketFactory socketFactory, String schema, int defaultPort) { // // switch protocol // due to how HttpCommons work internally this dance is best to be kept as is // Protocol directHttp = Protocol.getProtocol(schema); if (directHttp instanceof DelegatedProtocol) { // unwrap the original directHttp = ((DelegatedProtocol)directHttp).getOriginal(); assert directHttp instanceof DelegatedProtocol == false; } Protocol proxiedHttp = new DelegatedProtocol(socketFactory, directHttp, schema, defaultPort); // NB: register the new protocol since when using absolute URIs, HttpClient#executeMethod will override the configuration (#387) // NB: hence why the original/direct http protocol is saved - as otherwise the connection is not closed since it is considered different // NB: (as the protocol identities don't match) // this is not really needed since it's being replaced later on // hostConfig.setHost(proxyHost, proxyPort, proxiedHttp); Protocol.registerProtocol(schema, proxiedHttp); // end dance }