-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PoxyProxy can now listen on SSL ports.
- Loading branch information
Showing
4 changed files
with
267 additions
and
44 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
33 changes: 33 additions & 0 deletions
33
src/main/java/com/microsoft/tfs/tools/poxy/SSLSocketListener.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.microsoft.tfs.tools.poxy; | ||
|
||
import java.net.ServerSocket; | ||
import java.net.Socket; | ||
import java.util.concurrent.ExecutorService; | ||
|
||
import javax.net.ssl.SSLContext; | ||
import javax.net.ssl.SSLSocket; | ||
|
||
public class SSLSocketListener extends SocketListener | ||
{ | ||
private final SSLContext sslContext; | ||
|
||
public SSLSocketListener(ServerSocket serverSocket, ExecutorService executorService, Options options, | ||
SSLContext sslContext) | ||
{ | ||
super(serverSocket, executorService, options); | ||
|
||
this.sslContext = sslContext; | ||
} | ||
|
||
@Override | ||
protected Socket accept() throws Exception | ||
{ | ||
Socket rawSocket = getServerSocket().accept(); | ||
|
||
final SSLSocket sslSocket = (SSLSocket) sslContext.getSocketFactory().createSocket(rawSocket, null, | ||
rawSocket.getPort(), false); | ||
sslSocket.setUseClientMode(false); | ||
|
||
return sslSocket; | ||
} | ||
} |
Oops, something went wrong.