-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c18f9f5
commit 59eac98
Showing
14 changed files
with
315 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
folsom/src/main/java/com/spotify/folsom/client/tls/DefaultSSLEngineFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.spotify.folsom.client.tls; | ||
|
||
import java.security.NoSuchAlgorithmException; | ||
import javax.net.ssl.SSLContext; | ||
import javax.net.ssl.SSLEngine; | ||
|
||
public class DefaultSSLEngineFactory implements SSLEngineFactory { | ||
private final SSLContext sslContext; | ||
private final boolean reuseSession; | ||
|
||
public DefaultSSLEngineFactory(final boolean reuseSession) throws NoSuchAlgorithmException { | ||
this(SSLContext.getDefault(), reuseSession); | ||
} | ||
|
||
public DefaultSSLEngineFactory(final SSLContext sslContext, final boolean reuseSession) { | ||
this.sslContext = sslContext; | ||
this.reuseSession = reuseSession; | ||
} | ||
|
||
@Override | ||
public SSLEngine createSSLEngine(final String hostname, final int port) { | ||
final SSLEngine sslEngine; | ||
|
||
if (reuseSession) { | ||
sslEngine = sslContext.createSSLEngine(hostname, port); | ||
} else { | ||
sslEngine = sslContext.createSSLEngine(); | ||
} | ||
|
||
sslEngine.setUseClientMode(true); | ||
return sslEngine; | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
folsom/src/main/java/com/spotify/folsom/client/tls/SSLEngineFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.spotify.folsom.client.tls; | ||
|
||
import javax.net.ssl.SSLEngine; | ||
|
||
public interface SSLEngineFactory { | ||
SSLEngine createSSLEngine(String hostname, int port); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.