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()
199199 IOException lastError = null ;
200200
201201 try {
202- _socket = new Socket ();
202+ _socket = _options . socketFactory . createSocket ();
203203 _socket .connect ( _addr , _options .connectTimeout );
204204
205205 _socket .setTcpNoDelay ( ! USE_NAGLE );
Original file line number Diff line number Diff line change 1818
1919package com .mongodb ;
2020
21+ import javax .net .SocketFactory ;
2122
2223/**
2324 * Various settings for the driver
@@ -41,7 +42,9 @@ public void reset(){
4142 w = 0 ;
4243 wtimeout = 0 ;
4344 fsync = false ;
45+ j = false ;
4446 dbDecoderFactory = DefaultDBDecoder .FACTORY ;
47+ socketFactory = SocketFactory .getDefault ();
4548 }
4649
4750 /**
@@ -166,6 +169,12 @@ else if (safe)
166169 */
167170 public boolean j ;
168171
172+ /**
173+ * sets the socket factory for creating sockets to mongod
174+ * Default is SocketFactory.getDefault()
175+ */
176+ public SocketFactory socketFactory ;
177+
169178 public String toString (){
170179 StringBuilder buf = new StringBuilder ();
171180 buf .append ( "description=" ).append ( description ).append ( ", " );
You can’t perform that action at this time.
0 commit comments