/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @bug 6774170
* @summary Connect to a server socket returned by the LocalRMIServerSocketFactory.
*
* @author Daniel Fuchs
*
* @run compile -XDignore.symbol.file=true -source 1.6 -g LocalRMIServerSocketFactoryTest.java
* @run main LocalRMIServerSocketFactoryTest
*/
public class LocalRMIServerSocketFactoryTest {
new SynchronousQueue<Exception>();
private Result() {
super("SUCCESS: No exception was thrown");
}
}
// Wait for the server to set the error field.
return;
}
// case of 6674166: this is very unlikely to happen, even if
// both 6674166 and 6774170 aren't fixed. If it happens
// however, it might indicate that neither defects are fixed.
if (x instanceof NullPointerException) {
"Congratulations! it seems you have triggered 6674166. " +
"Neither 6674166 nor 6774170 seem to be fixed: " + x, x);
} else if (x instanceof IOException) {
"Unexpected IOException. Maybe you triggered 6674166? " +
x, x);
} else if (x != null) {
"Ouch, that's bad. " +
"This is a new kind of unexpected exception " +
x, x);
}
}
final LocalRMIServerSocketFactory f =
new LocalRMIServerSocketFactory();
final int port = s.getLocalPort();
public void run() {
while (true) {
try {
} catch (Exception x) {
x.printStackTrace();
error = x;
} finally {
try {
// wait for the client to get the exception.
} catch (Exception x) {
// too bad!
x.printStackTrace();
return;
}
}
}
}
};
t.setDaemon(true);
t.start();
checkError("new Socket((String)null, port)");
checkError("new Socket(InetAddress.getByName(null), port)");
checkError("new Socket(localhost, port)");
checkError("new Socket(127.0.0.1, port)");
}
}