File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -199,7 +199,7 @@ boolean _open()
199
199
IOException lastError = null ;
200
200
201
201
try {
202
- _socket = new Socket ();
202
+ _socket = _options . socketFactory . createSocket ();
203
203
_socket .connect ( _addr , _options .connectTimeout );
204
204
205
205
_socket .setTcpNoDelay ( ! USE_NAGLE );
Original file line number Diff line number Diff line change 18
18
19
19
package com .mongodb ;
20
20
21
+ import javax .net .SocketFactory ;
21
22
22
23
/**
23
24
* Various settings for the driver
@@ -41,7 +42,9 @@ public void reset(){
41
42
w = 0 ;
42
43
wtimeout = 0 ;
43
44
fsync = false ;
45
+ j = false ;
44
46
dbDecoderFactory = DefaultDBDecoder .FACTORY ;
47
+ socketFactory = SocketFactory .getDefault ();
45
48
}
46
49
47
50
/**
@@ -166,6 +169,12 @@ else if (safe)
166
169
*/
167
170
public boolean j ;
168
171
172
+ /**
173
+ * sets the socket factory for creating sockets to mongod
174
+ * Default is SocketFactory.getDefault()
175
+ */
176
+ public SocketFactory socketFactory ;
177
+
169
178
public String toString (){
170
179
StringBuilder buf = new StringBuilder ();
171
180
buf .append ( "description=" ).append ( description ).append ( ", " );
You can’t perform that action at this time.
0 commit comments